Introduction to Zend Framework

 Learning Zend Framework

appendix

 Zend Framework Reference


  •  Zend_Gdata
  •  Zend_Http
  •  Zend_InfoCard
  •  Zend_Json
  •  Zend_Layout
  •  Zend_Ldap
  •  Zend_Loader
  •  Zend_Locale
  •  Zend_Log
  •  Zend_Mail
  •  Zend_Markup
  •  Zend_Measure
  •  Zend_Memory
  •  Zend_Mime
  •  Zend_Navigation
  •  Zend_Oauth
  •  Zend_OpenId
  •  Zend_Paginator
  •  Zend_Pdf
  •  Zend_ProgressBar
  •  Zend_Queue
  •  Zend_Reflection
  •  Zend_Registry
  •  Zend_Rest

  •  Zend_Search_Lucene
  •  Zend_Serializer
  •  Zend_Server
  •  Zend_Service
  •  Zend_Session
  •  Zend_Soap
  •  Zend_Tag
  •  Zend_Test
  •  Zend_Text
  •  Zend_TimeSync
  •  Zend_Tool
  •  Zend_Tool_Framework
  •  Zend_Tool_Project
  •  Zend_Translate
  •  Zend_Uri
  •  Zend_Validate
  •  Zend_Version
  •  Zend_View
  •  Zend_Wildfire
  •  Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Update 2011-11-16 - Revision 24438 - Version ZF 1.11.x

    54.2. Creating and Loading PDF Documents

    The Zend_Pdf class represents PDF documents and provides document-level operations.

    To create a new document, a new Zend_Pdf object should first be created.

    Zend_Pdf class also provides two static methods to load an existing PDF document. These are the Zend_Pdf::load() and Zend_Pdf::parse() methods. Both of them return Zend_Pdf objects as a result or throw an exception if an error occurs.

    Example 54.1. Create new or load existing PDF document

    ...
    // Create a new PDF document
    $pdf1 = new Zend_Pdf();

    // Load a PDF document from a file
    $pdf2 Zend_Pdf::load($fileName);

    // Load a PDF document from a string
    $pdf3 Zend_Pdf::parse($pdfString);
    ...

    The PDF file format supports incremental document update. Thus each time a document is updated, then a new revision of the document is created. Zend_Pdf component supports the retrieval of a specified revision.

    A revision can be specified as a second parameter to the Zend_Pdf::load() and Zend_Pdf::parse() methods or requested by calling the Zend_Pdf::rollback() method. [9] call.

    Example 54.2. Requesting Specific Revisions of a PDF Document

    ...
    // Load the previous revision of the PDF document
    $pdf1 Zend_Pdf::load($fileName1);

    // Load the previous revision of the PDF document
    $pdf2 Zend_Pdf::parse($pdfString1);

    // Load the first revision of the PDF document
    $pdf3 Zend_Pdf::load($fileName);
    $revisions $pdf3->revisions();
    $pdf3->rollback($revisions 1);
    ...



    [9] Zend_Pdf::rollback() method must be invoked before any changes are applied to the document, otherwise the behavior is not defined.

    digg delicious meneame google twitter technorati facebook

    Comments

    Loading...