PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Save Changes to PDF Documents

There are two methods that save changes to PDF documents: the Zend_Pdf::save() and Zend_Pdf::render() methods.

Zend_Pdf::save($filename, $updateOnly = false) saves the PDF document to a file. If $updateOnly is TRUE, then only the new PDF file segment is appended to a file. Otherwise, the file is overwritten.

Zend_Pdf::render($newSegmentOnly = false) returns the PDF document as a string. If $newSegmentOnly is TRUE, then only the new PDF file segment is returned.

Example 659. Saving PDF Documents

<?php
...
// Load the PDF document
$pdf Zend_Pdf::load($fileName);
...
// Update the PDF document
$pdf->save($fileNametrue);
// Save document as a new file
$pdf->save($newFileName);

// Return the PDF document as a string
$pdfString $pdf->render();

...

Zend Framework