<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Document Info and Metadata - Zend Framework Manual</title>

</head>
<body>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.pdf.interactive-features.html">Interactive Features</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.pdf.html">Zend_Pdf</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.pdf.usage.html">Zend_Pdf module usage example</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.pdf.info" class="section"><div class="info"><h1 class="title">Document Info and Metadata</h1></div>
    
    

    <p class="para">
        A <acronym class="acronym">PDF</acronym> document may include general information such as the document&#039;s
        title, author, and creation and modification dates.
    </p>

    <p class="para">
        Historically this information is stored using special Info structure. This structure
        is available for read and writing as an associative array using
        <span class="property">properties</span> public property of <span class="classname">Zend_Pdf</span> objects:
    </p>

    <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span> = Zend_Pdf::<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pdfPath</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Title'</span><span style="color: #66cc66;">&#93;</span> . <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Author'</span><span style="color: #66cc66;">&#93;</span> . <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Title'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">'New Title.'</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pdfPath</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></div></div></div>


    <p class="para">
        The following keys are defined by <acronym class="acronym">PDF</acronym> v1.4 (Acrobat 5) standard:

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Title</em> - string, optional, the document&#039;s title.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Author</em> - string, optional, the name of the person who
                    created the document.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Subject</em> - string, optional, the subject of the document.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Keywords</em> - string, optional, keywords associated with the
                    document.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Creator</em> - string, optional, if the document was converted
                    to <acronym class="acronym">PDF</acronym> from another format, the name of the application (for
                    example, Adobe FrameMaker®) that created the original document from which it was
                    converted.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Producer</em> - string, optional, if the document was converted
                    to <acronym class="acronym">PDF</acronym> from another format, the name of the application (for
                    example, Acrobat Distiller) that converted it to <acronym class="acronym">PDF</acronym>..
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">CreationDate</em> - string, optional, the date and time the
                    document was created, in the following form: &quot;D:YYYYMMDDHHmmSSOHH&#039;mm&#039;&quot;, where:

                    <ul class="itemizedlist">
                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">YYYY</em> is the year.
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">MM</em> is the month.
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">DD</em> is the day (01–31).
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">HH</em> is the hour (00–23).
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">mm</em>is the minute (00–59).
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">SS</em> is the second (00–59).
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">O</em> is the relationship of local time to
                                Universal Time (UT), denoted by one of the characters +, −, or Z
                                (see below).
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">HH</em> followed by &#039; is the absolute value of the
                                offset from UT in hours (00–23).
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">mm</em> followed by &#039; is the absolute value of the
                                offset from UT in minutes (00–59).
                            </p>
                        </li>
                    </ul>

                    The apostrophe character (&#039;) after HH and mm is part of the syntax. All fields
                    after the year are optional. (The prefix D:, although also optional, is strongly
                    recommended.) The default values for MM and DD are both 01; all other numerical
                    fields default to zero values. A plus sign (+) as the value of the O field
                    signifies that local time is later than UT, a minus sign (−) that local time is
                    earlier than UT, and the letter Z that local time is equal to UT. If no UT
                    information is specified, the relationship of the specified time to UT is
                    considered to be unknown. Whether or not the time zone is known, the rest of the
                    date should be specified in local time.
                </p>

                <p class="para">
                    For example, December 23, 1998, at 7:52 PM, U.S. Pacific Standard Time, is
                    represented by the string &quot;D:199812231952−08&#039;00&#039;&quot;.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">ModDate</em> - string, optional, the date and time the document
                    was most recently modified, in the same form as
                    <em class="emphasis">CreationDate</em>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Trapped</em> - boolean, optional, indicates whether the document
                    has been modified to include trapping information.

                    <ul class="itemizedlist">
                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis"><b><tt>TRUE</tt></b></em> - The document has
                                been fully trapped; no further trapping is needed.
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis"><b><tt>FALSE</tt></b></em> - The document has
                                not yet been trapped; any desired trapping must still be done.
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis"><b><tt>NULL</tt></b></em> - Either it is
                                unknown whether the document has been trapped or it has been partly
                                but not yet fully trapped; some additional trapping may still be
                                needed.
                            </p>
                        </li>
                    </ul>
                </p>
            </li>
        </ul>
    </p>

    <p class="para">
        Since <acronym class="acronym">PDF</acronym> v 1.6 metadata can be stored in the special
        <acronym class="acronym">XML</acronym> document attached to the <acronym class="acronym">PDF</acronym> (XMP - <a href="http://www.adobe.com/products/xmp/" class="link external">&raquo; Extensible Metadata Platform</a>).
    </p>

    <p class="para">
        This <acronym class="acronym">XML</acronym> document can be retrieved and attached to the PDF with
         <span class="methodname">Zend_Pdf::getMetadata()</span> and
         <span class="methodname">Zend_Pdf::setMetadata($metadata)</span> methods:
    </p>

    <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span> = Zend_Pdf::<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pdfPath</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$metadata</span> = <span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">getMetadata</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$metadataDOM</span> = <span style="color: #000000; font-weight: bold;">new</span> DOMDocument<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$metadataDOM</span>-&gt;<span style="color: #006600;">loadXML</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$metadata</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$xpath</span> = <span style="color: #000000; font-weight: bold;">new</span> DOMXPath<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$metadataDOM</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdfPreffixNamespaceURI</span> = <span style="color: #0000ff;">$xpath</span>-&gt;<span style="color: #006600;">query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/rdf:RDF/rdf:Description'</span><span style="color: #66cc66;">&#41;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;<span style="color: #006600;">item</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;<span style="color: #006600;">lookupNamespaceURI</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'pdf'</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$xpath</span>-&gt;<span style="color: #006600;">registerNamespace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'pdf'</span>, <span style="color: #0000ff;">$pdfPreffixNamespaceURI</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$titleNode</span> = <span style="color: #0000ff;">$xpath</span>-&gt;<span style="color: #006600;">query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/rdf:RDF/rdf:Description/pdf:Title'</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">item</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$title</span> = <span style="color: #0000ff;">$titleNode</span>-&gt;<span style="color: #006600;">nodeValue</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">...</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$titleNode</span>-&gt;<span style="color: #006600;">nodeValue</span> = <span style="color: #ff0000;">'New title'</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">setMetadata</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$metadataDOM</span>-&gt;<span style="color: #006600;">saveXML</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pdfPath</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></div></div></div>


    <p class="para">
        Common document properties are duplicated in the Info structure and Metadata document (if
        presented). It&#039;s user application responsibility now to keep them synchronized.
    </p>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.pdf.interactive-features.html">Interactive Features</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.pdf.html">Zend_Pdf</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.pdf.usage.html">Zend_Pdf module usage example</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.pdf.html">Zend_Pdf</a></li>
  <li><a href="zend.pdf.introduction.html">简介</a></li>
  <li><a href="zend.pdf.create.html">生成和加载 PDF 文档</a></li>
  <li><a href="zend.pdf.save.html">保存修改到 PDF 文档</a></li>
  <li><a href="zend.pdf.pages.html">文档页面</a></li>
  <li><a href="zend.pdf.drawing.html">Drawing</a></li>
  <li><a href="zend.pdf.interactive-features.html">Interactive Features</a></li>
  <li class="active"><a href="zend.pdf.info.html">Document Info and Metadata</a></li>
  <li><a href="zend.pdf.usage.html">Zend_Pdf module usage example</a></li>
 </ul>
 </td>
    </tr>
</table>
</body>
</html>