1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
<?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:
-->
|