Zend_Pdf adding Calibre (ttf) font to PDF

449 Views Asked by At

I am using a gift card generating wordpress plugin. It is using the Zend framework. After looking at other threads on stackoverflow this is how far I have got so far;

//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 );

This currently doesn't work. It does not break the website but when attempting to complete checkout it throws a WooCommerce "Internal Server Error" which has been happening every-time I get the Zend php incorrect.

0

There are 0 best solutions below