zendframework/zf1

Handwritten Font generates an Error

Closed this issue · 5 comments

semaf commented

I am trying to use the Amatic Font from Google in my PDF File but it gives me an Error like below. Could that be because the Font Type? I have tested with Open Sans and it is working.

Font is added like as
$fontBold = Zend_Pdf_Font::fontWithPath("main/zend/amaticb.ttf");

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'Unable to read version 4 table' in /var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/FileParser/Font/OpenType.php:555\nStack trace:\n#0 /var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/FileParser/Font/OpenType.php(121): Zend_Pdf_FileParser_Font_OpenType->_parseOs2Table()\n#1 /var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/FileParser/Font/OpenType/TrueType.php(83): Zend_Pdf_FileParser_Font_OpenType->parse()\n#2 /var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/Font.php(701): Zend_Pdf_FileParser_Font_OpenType_TrueType->parse()\n#3 /var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/Font.php(615): Zend_Pdf_Font::_extractTrueTypeFont(Object(Zend_Pdf_FileParserDataSource_File), 0)\n#4 /var/www/vhosts/httpdocs/main/zend/invoice.php(27): Zend_Pdf_Font::fontWithPath('/var/www/vhosts...')\n#5 {main}\n\nNext exception 'Zend_Pdf_Exception' wi...\n'

I am using this Script for my tests https://github.com/phpmasterdotcom/GeneratingInvoicesWithZendPdf/blob/master/public/invoice.php

Could that be because the Font Type?

Try another one, because the error message says some font informations are missing.

semaf commented

It is working after I have changed on the File OpenType.php:553 the from $tableVersion > 3 to $tableVersion > 4

if (($tableVersion < 0) || ($tableVersion > 4)) {

@semaf
Do you know what "table version" means?

semaf commented

No did not check it.

@semaf

No did not check it.

That is a very very bad idea!

At the moment can I see no error in Zend_PDF. Therefore I will close this issue.