ZF-2387: drawText() fails on Solaris

Description

I followed the tutorial by Alexander Veremyev and it seems that drawText() will not work on a Sun Solaris server. I tested the identical code on my local windows machine and it worked fine. The output PDF is blank; however, when you view the properties of the document, you can see the information on the specified font, but no text renders. The following is the code I'm testing:


<?php
require_once 'Zend/Pdf.php';

// Create new PDF 
$pdf = new Zend_Pdf();
                
// Add new page to the document 
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
$pdf->pages[] = $page;
                
//set font
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$page->setFont($font, 24);
                
$page->drawText('Hello world!', 25, 750);
$pdfData = $pdf->render();
                
//store a date stamp and use it in the file name of the pdf when the report outputs to the browser
$date_stamp = date("Y-m-d_g-i_a");
header("Content-type: application/x-pdf");
header("Content-Disposition: inline; filename=PurgeReport_$date_stamp.pdf");

echo $pdfData;
?>

It fails both with fontWithName and fontWithPath.

Comments

This file shows the blank file with no text, but the font properties of the document showing the correct font. No text was drawn on the page with drawText(). This same PDF outputed correctly from a windows based machine.

ZF-2387 Should be disregarded as it duplicates the issue in ZF-588. The problem actually existed within the iconv extentions implementation across a couple servers in our organization. Sorry for the confusion.

ZF-588 is actually another issue.

The problem, described in the ZF-588 appears only with '€' symbol

Gary, could I ask you to attach generated PDF to the issue? It may help a lot.

Hi Alexander, the problem actually had to do with the iconv extension in our PHP installation. Being that the character encoding was not found, it silently dropped all the characters it was trying to draw using drawText(). The framework method works as its supposed to and there is no actual issue. Once I found that our iconv was at fault everything came together. Thank you for your response.

Good! I think that may be a common problem for Zend_Pdf and other ZF components and should be mentioned somewhere in the documentation... Thanks for the info!

Please evaluate and categorize as necessary.