20.3. Save changes to the PDF document.
Anterior | Capítulo 20. Zend_Pdf | Próxima

## 20.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)` 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.

Exemplo 20.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);

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

    ...
    ?>

Anterior | Acima | Próxima
20.2. Creating and loading PDF documents. | Principal | 20.4. Document pages.