13.3. Save changes to the PDF document.

There are two methods, which provide saving changes to the PDF document. These are Zend_Pdf::save() and Zend_Pdf::render() methods.

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

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

Пример 13.3. Save PDF document.

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

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

...
?>