I have a problem: when I run this script on IBM i
- Code: Select all
require_once 'Zend/Pdf.php';
require_once 'Zend/Config.php';
require_once 'Zend/Barcode.php';
require_once 'Zend/Mail.php';
require_once 'Zend/Barcode/Renderer/Pdf.php';
require_once 'Zend/Loader/Autoloader.php';
ini_set('include_path', '/usr/local/zendsvr/share/ZendFramework/library/');
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
$pdf = new Zend_Pdf();
//... your work
//a font is mandatory for Pdf
Zend_Barcode::setBarcodeFont('arial.ttf');
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK-1');
$rendererOptions = array('topOffset' => 50);
$pdfWithBarcode = Zend_Barcode::factory('code39', 'pdf',
$barcodeOptions, $rendererOptions)->setResource($pdf)->draw();
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK-2');
$rendererOptions = array('topOffset' => 100);
$pdfWithBarcode = Zend_Barcode::factory('code39', 'pdf',
$barcodeOptions, $rendererOptions)->setResource($pdfWithBarcode)->draw();
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK-3');
$rendererOptions = array('topOffset' => 150);
$pdfWithBarcode = Zend_Barcode::factory('code39', 'pdf',
$barcodeOptions, $rendererOptions)->setResource($pdfWithBarcode)->draw();
// and the end render your Zend_Pdf
$pdfWithBarcode->save('testbarcode.pdf');
I receive this error when I set barcode font:
Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'Null character is not allowed in PDF Names' in /usr/local/zendsvr/share/ZendFramework/library/Zend/Pdf/Element/Name.php:56 Stack trace: #0 /usr/local/zendsvr/share/ZendFramework/library/Zend/Pdf/Resource/Font/CidFont.php(121): Zend_Pdf_Element_Name->__construct('?A?r?i?a?l?M?T') #1 /usr/local/zendsvr/share/ZendFramework/library/Zend/Pdf/Resource/Font/CidFont/TrueType.php(64):........
I think the problem is the ttf file that I upload From windows to IBM i. You can see in the figure that the name of the font is created with null characters within the framework classes.
I think that the font name is read from the file ttf. For this reason I think the ttf file is not good for IBM i.
Can you help me?
Thanks
Benny

