Your code worked for me if I changed
$page1->setFont($font,
36)->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'));
to
$page1->setFont($font, 36);
$page1->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'));
Terre
_____
From: Salvador Benimeli [mailto:[email protected]]
Sent: Saturday, March 21, 2009 8:19 PM
To: [email protected]
Subject: [fw-general] Problems creating a simple pdf file
Hello,
I'm trying to create a simple pdf file, but I'm doing someting wrong because
I always get a blank output and no pdf file is generate.
I have the following code in a controller function:
// Create new PDF
$pdf = new Zend_Pdf();
// Add new page to the document
$pdf->pages[] = ($page1 = $pdf->newPage('A4'));
// Create new font
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
// Apply font and draw text
$page1->setFont($font,
36)->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'));
$page1->drawText('Helvetica 36 text string', 60, 500);
die('hello');
$pdfData = $pdf->render();
header("Content-Disposition: inline; filename=result.pdf");
header("Content-type: application/x-pdf");
echo $pdfData;
If I execute this code, the die statement is never reached and I get a blank
output on the browser but when I comment the line
$page1->drawText('Helvetica 36 text string', 60, 500); it works and I get a
blank pdf file.
I think the problem is in drawText but I do not why.
Anyone can help me, please?
Thanks in advance.
I'm using archlinux distro.