Documentation

Save Changes to PDF Documents - Zend_Pdf

Save Changes to PDF Documents

There are two methods that save changes to PDF documents: the 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.

Example #1 Saving PDF Documents

  1. ...
  2. // Load the PDF document
  3. $pdf = Zend_Pdf::load($fileName);
  4. ...
  5. // Update the PDF document
  6. $pdf->save($fileName, true);
  7. // Save document as a new file
  8. $pdf->save($newFileName);
  9.  
  10. // Return the PDF document as a string
  11. $pdfString = $pdf->render();
  12.  
  13. ...

Copyright

© 2006-2021 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts