Zend_Pdf-Save.xml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.pdf.save">
  4. <title>Save Changes to PDF Documents</title>
  5. <para>
  6. There are two methods that save changes to <acronym>PDF</acronym> documents: the
  7. <methodname>Zend_Pdf::save()</methodname> and <methodname>Zend_Pdf::render()</methodname>
  8. methods.
  9. </para>
  10. <para>
  11. <methodname>Zend_Pdf::save($filename, $updateOnly = false)</methodname> saves the
  12. <acronym>PDF</acronym> document to a file. If $updateOnly is <constant>TRUE</constant>,
  13. then only the new <acronym>PDF</acronym> file segment is appended to a file. Otherwise, the
  14. file is overwritten.
  15. </para>
  16. <para>
  17. <methodname>Zend_Pdf::render($newSegmentOnly = false)</methodname> returns the
  18. <acronym>PDF</acronym> document as a string. If $newSegmentOnly is
  19. <constant>TRUE</constant>, then only the new <acronym>PDF</acronym> file segment is
  20. returned.
  21. </para>
  22. <example id="zend.pdf.save.example-1">
  23. <title>Saving PDF Documents</title>
  24. <programlisting language="php"><![CDATA[
  25. ...
  26. // Load the PDF document
  27. $pdf = Zend_Pdf::load($fileName);
  28. ...
  29. // Update the PDF document
  30. $pdf->save($fileName, true);
  31. // Save document as a new file
  32. $pdf->save($newFileName);
  33. // Return the PDF document as a string
  34. $pdfString = $pdf->render();
  35. ...
  36. ]]></programlisting>
  37. </example>
  38. </sect1>
  39. <!--
  40. vim:se ts=4 sw=4 et:
  41. -->