File: Zend_Pdf-Create.xml

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (83 lines) | stat: -rw-r--r-- 2,708 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.pdf.create">
    <title>Creating and Loading PDF Documents</title>

    <para>
        The <classname>Zend_Pdf</classname> class represents <acronym>PDF</acronym> documents and
        provides document-level operations.
    </para>

    <para>
        To create a new document, a new <classname>Zend_Pdf</classname> object should first be
        created.
    </para>

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

    <example id="zend.pdf.create.example-1">
        <title>Create new or load existing PDF document</title>

        <programlisting language="php"><![CDATA[
...
// 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);
...
]]></programlisting>
    </example>

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

    <para>
        A revision can be specified as a second parameter to the
        <methodname>Zend_Pdf::load()</methodname> and <methodname>Zend_Pdf::parse()</methodname>
        methods or requested by calling the <methodname>Zend_Pdf::rollback()</methodname> method.

        <footnote>
            <para>
                <methodname>Zend_Pdf::rollback()</methodname> method must be invoked before any
                changes are applied to the document, otherwise the behavior is not defined.
            </para>
        </footnote>

        call.
    </para>

    <example id="zend.pdf.create.example-2">
        <title>Requesting Specific Revisions of a PDF Document</title>

        <programlisting language="php"><![CDATA[
...
// Load the previous revision of the PDF document
$pdf1 = Zend_Pdf::load($fileName, 1);

// Load the previous revision of the PDF document
$pdf2 = Zend_Pdf::parse($pdfString, 1);

// Load the first revision of the PDF document
$pdf3 = Zend_Pdf::load($fileName);
$revisions = $pdf3->revisions();
$pdf3->rollback($revisions - 1);
...
]]></programlisting>
    </example>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->