Php Zend_Pdf将Calibre(ttf)字体添加到Pdf

Php Zend_Pdf将Calibre(ttf)字体添加到Pdf,php,zend-pdf,Php,Zend Pdf,我正在使用礼品卡生成wordpress插件。它正在使用Zend框架。在查看stackoverflow上的其他线程之后,这就是我到目前为止所做的工作 //load font from file system - last one calibre is the one I added $pdf = new Zend_Pdf (); $bold_font = Zend_Pdf_Font::fontWithName ( Zend_Pdf_Font::FONT_HELVETICA_BOLD ); $fo

我正在使用礼品卡生成wordpress插件。它正在使用Zend框架。在查看stackoverflow上的其他线程之后,这就是我到目前为止所做的工作

//load font from file system - last one calibre is the one I added

$pdf = new Zend_Pdf ();
$bold_font = Zend_Pdf_Font::fontWithName ( Zend_Pdf_Font::FONT_HELVETICA_BOLD );
$font_regular = Zend_Pdf_Font::fontWithName ( Zend_Pdf_Font::FONT_HELVETICA );
$font = Zend_Pdf_Font::fontWithName ( Zend_Pdf_Font::FONT_HELVETICA_BOLD );
$calibre = Zend_Pdf_Font::fontWithPath ("/lib/customfonts/CalibreMedium.ttf");

//selecting the font to be used
$page->setFont ( $calibre, 14 );

这目前不起作用。它不会破坏网站,但在尝试完成结帐时,会抛出一个WooCommerce“内部服务器错误”,每次我发现Zend php不正确时都会发生此错误。

不确定如何检查它们,请立即用谷歌搜索。谢谢
“/lib/customfonts/calibremedia.ttf”
是一个绝对路径。。。如果您将其更改为
”/lib/customfonts/calibremedia.ttf“
,它可能会工作。只是尝试了一下,没有运气。还尝试将路径更改为“.\lib\Zend\Pdf\Resource\Font\customfonts\CaliberMedium.ttf”,以确保它位于Zend文件夹中,但仍然相同。