1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect1 id="zend.pdf.save">
4 <title>Save Changes to PDF Documents</title>
7 There are two methods that save changes to <acronym>PDF</acronym> documents: the
8 <methodname>Zend_Pdf::save()</methodname> and <methodname>Zend_Pdf::render()</methodname>
13 <methodname>Zend_Pdf::save($filename, $updateOnly = false)</methodname> saves the
14 <acronym>PDF</acronym> document to a file. If $updateOnly is <constant>TRUE</constant>,
15 then only the new <acronym>PDF</acronym> file segment is appended to a file. Otherwise, the
20 <methodname>Zend_Pdf::render($newSegmentOnly = false)</methodname> returns the
21 <acronym>PDF</acronym> document as a string. If $newSegmentOnly is
22 <constant>TRUE</constant>, then only the new <acronym>PDF</acronym> file segment is
26 <example id="zend.pdf.save.example-1">
27 <title>Saving PDF Documents</title>
29 <programlisting language="php"><![CDATA[
31 // Load the PDF document
32 $pdf = Zend_Pdf::load($fileName);
34 // Update the PDF document
35 $pdf->save($fileName, true);
36 // Save document as a new file
37 $pdf->save($newFileName);
39 // Return the PDF document as a string
40 $pdfString = $pdf->render();