<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.pdf.save">
    <title>Save Changes to PDF Documents</title>

    <para>
        There are two methods that save changes to <acronym>PDF</acronym> documents: the
        <methodname>Zend_Pdf::save()</methodname> and <methodname>Zend_Pdf::render()</methodname>
        methods.
    </para>

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

    <para>
        <methodname>Zend_Pdf::render($newSegmentOnly = false)</methodname> returns the
        <acronym>PDF</acronym> document as a string. If $newSegmentOnly is
        <constant>TRUE</constant>, then only the new <acronym>PDF</acronym> file segment is
        returned.
    </para>

    <example id="zend.pdf.save.example-1">
        <title>Saving PDF Documents</title>

        <programlisting language="php"><![CDATA[
...
// Load the PDF document
$pdf = Zend_Pdf::load($fileName);
...
// Update the PDF document
$pdf->save($fileName, true);
// Save document as a new file
$pdf->save($newFileName);

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

...
]]></programlisting>
    </example>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->
