With a few tweaks, that did it! Thanks!
To answer your question, my headers and streaming were done from a separate
calling program using 'passthru', but it will work to have all within a
single file.
Not sure if it was the try/catch block, or maybe your save/restore of GS
after each page, but it works your way. I modified the headers a bit to
display inline in the browser instead of download, and to work in IE8
(worked as is in Firefox).
Here's my result code:
---
ini_set('include_path', '/library');
set_time_limit(0);
require_once("Zend/Exception.php");
require_once("Zend/Pdf.php");
require_once("Zend/Pdf/Exception.php");
//Quick and dirty example, that works:
// load pdf file
$pdf = Zend_Pdf::load('029044-02.pdf');
// Create new Style
$style = new Zend_Pdf_Style();
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$style->setFont($font, 32);
$color = new Zend_Pdf_Color_Html('#000000'); //black
// Mark page as modified
foreach ($pdf->pages as $PDFpg){
//calculate the fontsize to use based on the dimensions of the page
$fontSize = intval($PDFpg->getHeight() / 10);
$style->setFont($font, $fontSize);
$PDFpg->saveGS()
->rotate(($PDFpg->getWidth() / 2), ($PDFpg->getHeight() / 2), 45)
->setStyle($style)
->setFillColor($color) //also sets font color
->setAlpha(0.2)
->drawText('U N R E L E A S E D', ($PDFpg->getWidth() / 2) - (4 *
$fontSize), ($PDFpg->getHeight() / 2) - ($fontSize / 2) )
->restoreGS();
}
$tmp = $pdf->render();
// send to browser as embedded pdf
header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=result.pdf;");
echo $tmp;
---
Thanks again for your help, vRandom
Tim
--
View this message in context:
http://www.nabble.com/Zend_pdf-doesn%27t-commit-changes-tp24850906p24868483.html
Sent from the Zend Framework mailing list archive at Nabble.com.