| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- EN-Revision: 17275 -->
- <!-- Reviewed: no -->
- <sect1 id="zend.pdf.interactive-features">
- <title>Interaktive Features</title>
- <sect2 id="zend.pdf.pages.interactive-features.destinations">
- <title>Ziele</title>
- <para>
- Ein Ziel definiert eine spezielle Sicht eines Dokuments, bestehend aus den folgenden
- Elementen:
- </para>
- <itemizedlist>
- <listitem>
- <para>Die Seite des Dokuments das angezeigt werden soll.</para>
- </listitem>
- <listitem>
- <para>Der Ort des Dokumenten Fensters auf dieser Seite.</para>
- </listitem>
- <listitem>
- <para>
- Der Zoom Faktor der verwendet werden soll wenn die Seite angezeigt wird.
- </para>
- </listitem>
- </itemizedlist>
- <para>
- Ziele können mit Outline Elementen ((<link
- linkend="zend.pdf.pages.interactive-features.outlines">Document Outline
- (bookmarks)</link>), Hinweisen (<link
- linkend="zend.pdf.pages.interactive-features.annotations">Annotations</link>), oder
- Aktionen (<link linkend="zend.pdf.pages.interactive-features.actions">Actions</link>)
- verknüpft werden. In jedem Fall spezifiziert das Ziel die Sicht des Dokuments welche
- dargestellt werden soll wenn das Outline Element oder der Hinweis geöffnet, oder die
- Aktion durchgeführt werden soll. Zusätzlich kann eine optionale Dokument Öffnungs-Aktion
- spezifiziert werden.
- </para>
- <sect3 id="zend.pdf.pages.interactive-features.destinations.types">
- <title>Unterstützte Zieltypen</title>
- <para>
- Die folgenden Typen werden von der <classname>Zend_Pdf</classname> Komponente
- unterstützt.
- </para>
- <sect4 id="zend.pdf.pages.interactive-features.destinations.types.zoom">
- <title>Zend_Pdf_Destination_Zoom</title>
- <para>
- Zeigt die spezifizierte Seite, mit den Koordinaten (Links, Oben) positioniert
- an der oberen-linken Ecke des Fensters und dem Inhalt der Seite vergrößert
- auf den Zoom Faktor.
- </para>
- <para>
- Zielobjekte können durch Verwendung der
- <methodname>Zend_Pdf_Destination_Zoom::create($page, $left = null, $top = null,
- $zoom = null)</methodname> Methode erstellt werden.
- </para>
- <para>
- Wobei:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$page</varname> eine Zielseite ist (ein
- <classname>Zend_Pdf_Page</classname> Objekt oder eine Seitennummer).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$left</varname> ist die linke Ecke der angezeigten Seite
- (float).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$top</varname> ist eine obere Ecke der angezeigten Seite
- (float).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$zoom</varname> ist ein Zoom Faktor (float).
- </para>
- </listitem>
- </itemizedlist>
- <para>
- <constant>NULL</constant>, wenn es für die <varname>$left</varname>,
- <varname>$top</varname> or <varname>$zoom</varname> Parameter spezifiziert wird,
- heißt "aktueller Wert der Viewer Anwendung".
- </para>
- <para>
- Die <classname>Zend_Pdf_Destination_Zoom</classname> Klasse bietet die folgenden
- Methoden an:
- </para>
- <itemizedlist>
- <listitem>
- <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setLeftEdge(float $left)</methodname>;</para>
- </listitem>
- <listitem>
- <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setTopEdge(float $top)</methodname>;</para>
- </listitem>
- <listitem>
- <para><type>Float</type><methodname>getZoomFactor()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setZoomFactor(float $zoom)</methodname>;</para>
- </listitem>
- </itemizedlist>
- </sect4>
- <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit">
- <title>Zend_Pdf_Destination_Fit</title>
- <para>
- Display the specified page, with the coordinates (left, top) positioned at
- the upper-left corner of the window and the contents of the page magnified
- by the factor zoom.
- Display the specified page, with its contents magnified just enough to fit
- the entire page within the window both horizontally and vertically. If
- the required horizontal and vertical magnification factors are different, use
- the smaller of the two, centering the page within the window in the other
- dimension.
- </para>
- <para>
- Destination object may be created using
- <methodname>Zend_Pdf_Destination_Fit::create($page)</methodname>
- method.
- </para>
- <para>
- Where <varname>$page</varname> is a destination page
- (a <classname>Zend_Pdf_Page</classname> object or a page number).
- </para>
- </sect4>
- <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-horizontally">
- <title>Zend_Pdf_Destination_FitHorizontally</title>
- <para>
- Display the specified page, with the vertical coordinate top positioned at
- the top edge of the window and the contents of the page magnified just enough
- to fit the entire width of the page within the window.
- </para>
- <para>
- Destination object may be created using
- <methodname>Zend_Pdf_Destination_FitHorizontally::create($page,
- $top)</methodname> method.
- </para>
- <para>
- Where:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$page</varname> is a destination page
- (a <classname>Zend_Pdf_Page</classname> object or a page number).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$top</varname> is a top edge of the displayed page
- (float).
- </para>
- </listitem>
- </itemizedlist>
- <para>
- <classname>Zend_Pdf_Destination_FitHorizontally</classname> class also
- provides the following methods:
- </para>
- <itemizedlist>
- <listitem>
- <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setTopEdge(float $top)</methodname>;</para>
- </listitem>
- </itemizedlist>
- </sect4>
- <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-vertically">
- <title>Zend_Pdf_Destination_FitVertically</title>
- <para>
- Display the specified page, with the horizontal coordinate left positioned
- at the left edge of the window and the contents of the page magnified just
- enough to fit the entire height of the page within the window.
- </para>
- <para>
- Destination object may be created using
- <methodname>Zend_Pdf_Destination_FitVertically::create($page,
- $left)</methodname> method.
- </para>
- <para>
- Where:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$page</varname> is a destination page
- (a <classname>Zend_Pdf_Page</classname> object or a page number).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$left</varname> is a left edge of the displayed page
- (float).
- </para>
- </listitem>
- </itemizedlist>
- <para>
- <classname>Zend_Pdf_Destination_FitVertically</classname> class also
- provides the following methods:
- </para>
- <itemizedlist>
- <listitem>
- <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setLeftEdge(float $left)</methodname>;</para>
- </listitem>
- </itemizedlist>
- </sect4>
- <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-rectangle">
- <title>Zend_Pdf_Destination_FitRectangle</title>
- <para>
- Display the specified page, with its contents magnified just enough to fit
- the rectangle specified by the coordinates left, bottom, right, and top
- entirely within the window both horizontally and vertically. If the required
- horizontal and vertical magnification factors are different, use the smaller
- of the two, centering the rectangle within the window in the other dimension.
- </para>
- <para>
- Destination object may be created using
- <methodname>Zend_Pdf_Destination_FitRectangle::create($page, $left, $bottom,
- $right, $top)</methodname> method.
- </para>
- <para>
- Where:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$page</varname> is a destination page
- (a <classname>Zend_Pdf_Page</classname> object or a page number).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$left</varname> is a left edge of the displayed page
- (float).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$bottom</varname> is a bottom edge of the displayed page
- (float).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$right</varname> is a right edge of the displayed page
- (float).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$top</varname> is a top edge of the displayed page
- (float).
- </para>
- </listitem>
- </itemizedlist>
- <para>
- <classname>Zend_Pdf_Destination_FitRectangle</classname> class also
- provides the following methods:
- </para>
- <itemizedlist>
- <listitem>
- <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setLeftEdge(float $left)</methodname>;</para>
- </listitem>
- <listitem>
- <para><type>Float</type><methodname>getBottomEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setBottomEdge(float $bottom)</methodname>;</para>
- </listitem>
- <listitem>
- <para><type>Float</type><methodname>getRightEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setRightEdge(float $right)</methodname>;</para>
- </listitem>
- <listitem>
- <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setTopEdge(float $top)</methodname>;</para>
- </listitem>
- </itemizedlist>
- </sect4>
- <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box">
- <title>Zend_Pdf_Destination_FitBoundingBox</title>
- <para>
- Display the specified page, with its contents magnified just enough to fit
- its bounding box entirely within the window both horizontally and vertically.
- If the required horizontal and vertical magnification factors are different,
- use the smaller of the two, centering the bounding box within the window in
- the other dimension.
- </para>
- <para>
- Destination object may be created using
- <methodname>Zend_Pdf_Destination_FitBoundingBox::create($page, $left, $bottom,
- $right, $top)</methodname> method.
- </para>
- <para>
- Where <varname>$page</varname> is a destination page
- (a <classname>Zend_Pdf_Page</classname> object or a page number).
- </para>
- </sect4>
- <sect4
- id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-horizontally">
- <title>Zend_Pdf_Destination_FitBoundingBoxHorizontally</title>
- <para>
- Display the specified page, with the vertical coordinate top positioned at
- the top edge of the window and the contents of the page magnified just enough
- to fit the entire width of its bounding box within the window.
- </para>
- <para>
- Destination object may be created using
- <methodname>Zend_Pdf_Destination_FitBoundingBoxHorizontally::create($page,
- $top)</methodname> method.
- </para>
- <para>
- Where
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$page</varname> is a destination page
- (a <classname>Zend_Pdf_Page</classname> object or a page number).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$top</varname> is a top edge of the displayed page
- (float).
- </para>
- </listitem>
- </itemizedlist>
- <para>
- <classname>Zend_Pdf_Destination_FitBoundingBoxHorizontally</classname> class
- also provides the following methods:
- </para>
- <itemizedlist>
- <listitem>
- <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setTopEdge(float $top)</methodname>;</para>
- </listitem>
- </itemizedlist>
- </sect4>
- <sect4
- id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-vertically">
- <title>Zend_Pdf_Destination_FitBoundingBoxVertically</title>
- <para>
- Display the specified page, with the horizontal coordinate left positioned at
- the left edge of the window and the contents of the page magnified just
- enough to fit the entire height of its bounding box within the window.
- </para>
- <para>
- Destination object may be created using
- <methodname>Zend_Pdf_Destination_FitBoundingBoxVertically::create($page,
- $left)</methodname> method.
- </para>
- <para>
- Where
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$page</varname> is a destination page
- (a <classname>Zend_Pdf_Page</classname> object or a page number).
- </para>
- </listitem>
- <listitem>
- <para>
- <varname>$left</varname> is a left edge of the displayed page
- (float).
- </para>
- </listitem>
- </itemizedlist>
- <para>
- <classname>Zend_Pdf_Destination_FitBoundingBoxVertically</classname> class
- also provides the following methods:
- </para>
- <itemizedlist>
- <listitem>
- <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
- </listitem>
- <listitem>
- <para><methodname>setLeftEdge(float $left)</methodname>;</para>
- </listitem>
- </itemizedlist>
- </sect4>
- <sect4 id="zend.pdf.pages.interactive-features.destinations.types.named">
- <title>Zend_Pdf_Destination_Named</title>
- <para>
- All destinations listed above are "Explicit Destinations".
- </para>
- <para>
- In addition to this, <acronym>PDF</acronym> document may contain a dictionary
- of such destinations which may be used to reference from outside the
- <acronym>PDF</acronym> (e.g.
- '<filename>http://www.mycompany.com/document.pdf#chapter3</filename>').
- </para>
- <para>
- <classname>Zend_Pdf_Destination_Named</classname> objects allow to refer
- destinations from the document named destinations dictionary.
- </para>
- <para>
- Named destination object may be created using
- <methodname>Zend_Pdf_Destination_Named::create(string $name)</methodname>
- method.
- </para>
- <para>
- <classname>Zend_Pdf_Destination_Named</classname> class provides the only one
- additional method:
- </para>
- <para>
- <type>String</type><methodname>getName()</methodname>;
- </para>
- </sect4>
- </sect3>
- <sect3 id="zend.pdf.pages.interactive-features.destinations.processing">
- <title>Document level destination processing</title>
- <para>
- <classname>Zend_Pdf</classname> class provides a set of destinations processing
- methods.
- </para>
- <para>
- Each destination object (including named destinations) can be resolved using the
- <methodname>resolveDestination($destination)</methodname> method. It returns
- corresponding <classname>Zend_Pdf_Page</classname> object, if destination target
- is found, or <constant>NULL</constant> otherwise.
- </para>
- <para>
- <methodname>Zend_Pdf::resolveDestination()</methodname> method also takes
- an optional boolean parameter <varname>$refreshPageCollectionHashes</varname>,
- which is true by default. It forces <classname>Zend_Pdf</classname> object
- to refresh internal page collection hashes since document pages list may be
- updated by user using <varname>Zend_Pdf::$pages</varname> property
- (<link linkend="zend.pdf.pages">Working with Pages</link>).
- It may be turned off for performance reasons,
- if it's known that document pages list wasn't changed since last method
- request.
- </para>
- <para>
- Complete list of named destinations can be retrieved using
- <methodname>Zend_Pdf::getNamedDestinations()</methodname> method. It returns
- an array of <classname>Zend_Pdf_Target</classname> objects, which are actually
- either an explicit destination or a GoTo action
- (<link linkend="zend.pdf.pages.interactive-features.actions">Actions</link>).
- </para>
- <para>
- <methodname>Zend_Pdf::getNamedDestination(string $name)</methodname> method returns
- specified named destination (an explicit destination or a GoTo action).
- </para>
- <para>
- <acronym>PDF</acronym> document named destinations dictionary may be updated with
- <methodname>Zend_Pdf::setNamedDestination(string $name, $destination)</methodname>
- method, where <varname>$destination</varname> is either an explicit destination
- (any destination except <classname>Zend_Pdf_Destination_Named</classname>) or
- a GoTo action.
- </para>
- <para>
- If <constant>NULL</constant> is specified in place of
- <varname>$destination</varname>, then specified named destination is removed.
- </para>
- <note>
- <para>
- Unresolvable named destinations are automatically removed from a document
- while document saving.
- </para>
- </note>
- <example id="zend.pdf.interactive-features.destinations.example-1">
- <title>Destinations usage example</title>
- <programlisting language="php"><![CDATA[
- $pdf = new Zend_Pdf();
- $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
- $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
- $page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
- // Page created, but not included into pages list
- $pdf->pages[] = $page1;
- $pdf->pages[] = $page2;
- $destination1 = Zend_Pdf_Destination_Fit::create($page2);
- $destination2 = Zend_Pdf_Destination_Fit::create($page3);
- // Returns $page2 object
- $page = $pdf->resolveDestination($destination1);
- // Returns null, page 3 is not included into document yet
- $page = $pdf->resolveDestination($destination2);
- $pdf->setNamedDestination('Page2', $destination1);
- $pdf->setNamedDestination('Page3', $destination2);
- // Returns $destination2
- $destination = $pdf->getNamedDestination('Page3');
- // Returns $destination1
- $pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page2'));
- // Returns null, page 3 is not included into document yet
- $pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page3'));
- ]]></programlisting>
- </example>
- </sect3>
- </sect2>
- <sect2 id="zend.pdf.pages.interactive-features.actions">
- <title>Actions</title>
- <para>
- Instead of simply jumping to a destination in the document, an annotation or
- outline item can specify an action for the viewer application to perform,
- such as launching an application, playing a sound, or changing an annotation's
- appearance state.
- </para>
- <sect3 id="zend.pdf.pages.interactive-features.actions.types">
- <title>Supported action types</title>
- <para>
- The following action types are recognized while loading <acronym>PDF</acronym>
- document:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_GoTo</classname> - go to
- a destination in the current document.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_GoToR</classname> - go to
- a destination in another document.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_GoToE</classname> - go to
- a destination in an embedded file.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_Launch</classname> - launch
- an application or open or print a document.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_Thread</classname> - begin reading
- an article thread.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_URI</classname> - resolve a
- <acronym>URI</acronym>.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_Sound</classname> - play a sound.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_Movie</classname> - play a movie.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_Hide</classname> - hides or shows
- one or more annotations on the screen.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_Named</classname> - execute an action
- predefined by the viewer application:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>NextPage</emphasis> - Go to the next page
- of the document.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>PrevPage</emphasis> - Go to the previous
- page of the document.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>FirstPage</emphasis> - Go to the first page
- of the document.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>LastPage</emphasis> - Go to the last page
- of the document.
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_SubmitForm</classname> - send data to
- a uniform resource locator.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_ResetForm</classname> - set fields
- to their default values.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_ImportData</classname> - import field
- values from a file.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_JavaScript</classname> - execute
- a JavaScript script.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_SetOCGState</classname> - set the state of
- one or more optional content groups.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_Rendition</classname> - control the
- playing of multimedia content (begin, stop, pause, or resume
- a playing rendition).
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_Trans</classname> - update the display
- of a document, using a transition dictionary.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Pdf_Action_GoTo3DView</classname> - set
- the current view of a 3D annotation.
- </para>
- </listitem>
- </itemizedlist>
- <para>
- Only <classname>Zend_Pdf_Action_GoTo</classname> actions can be created by
- user now. It can be done using
- <methodname>Zend_Pdf_Action_GoTo::create($destination)</methodname> method,
- where <varname>$destination</varname> is a
- <classname>Zend_Pdf_Destination</classname> object or string which can be used
- to identify named destination.
- </para>
- <para>
- It also supports the following methods:
- </para>
- </sect3>
- <sect3 id="zend.pdf.pages.interactive-features.actions.chaining">
- <title>Actions chaining</title>
- <para>
- Actions objects can be chained using <varname>Zend_Pdf_Action::$next</varname>
- public property.
- </para>
- <para>
- It's an array of <classname>Zend_Pdf_Action</classname> objects, which also
- may have their sub-actions.
- </para>
- <para>
- <classname>Zend_Pdf_Action</classname> class supports RecursiveIterator interface,
- so child actions may be iterated recursively:
- </para>
- <programlisting language="php"><![CDATA[
- $pdf = new Zend_Pdf();
- $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
- $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
- // Page created, but not included into pages list
- $page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
- $pdf->pages[] = $page1;
- $pdf->pages[] = $page2;
- $action1 = Zend_Pdf_Action_GoTo::create(
- Zend_Pdf_Destination_Fit::create($page2));
- $action2 = Zend_Pdf_Action_GoTo::create(
- Zend_Pdf_Destination_Fit::create($page3));
- $action3 = Zend_Pdf_Action_GoTo::create(
- Zend_Pdf_Destination_Named::create('Chapter1'));
- $action4 = Zend_Pdf_Action_GoTo::create(
- Zend_Pdf_Destination_Named::create('Chapter5'));
- $action2->next[] = $action3;
- $action2->next[] = $action4;
- $action1->next[] = $action2;
- $actionsCount = 1; // Note! Iteration doesn't include top level action and
- // walks through children only
- $iterator = new RecursiveIteratorIterator(
- $action1,
- RecursiveIteratorIterator::SELF_FIRST);
- foreach ($iterator as $chainedAction) {
- $actionsCount++;
- }
- printf("Actions in a tree: %d\n", $actionsCount++); // Prints 'Actions in a tree: 4'
- ]]></programlisting>
- </sect3>
- <sect3 id="zend.pdf.pages.interactive-features.actions.open-action">
- <title>Document Open Action</title>
- <para>
- Special open action may be specify a destination to be displayed or an action
- to be performed when the document is opened.
- </para>
- <para>
- <methodname>Zend_Pdf_Target Zend_Pdf::getOpenAction()</methodname> method
- returns current document open action (or null if open action is not set).
- </para>
- <para>
- <methodname>setOpenAction(Zend_Pdf_Target $openAction = null)</methodname>
- method sets document open action or clean it if <varname>$openAction</varname>
- is null.
- </para>
- </sect3>
- </sect2>
- <sect2 id="zend.pdf.pages.interactive-features.outlines">
- <title>Document Outline (bookmarks)</title>
- <para>
- A PDF document may optionally display a document outline on the screen, allowing
- the user to navigate interactively from one part of the document to another.
- The outline consists of a tree-structured hierarchy of outline items (sometimes
- called bookmarks), which serve as a visual table of contents to display the document’s
- structure to the user. The user can interactively open and close individual
- items by clicking them with the mouse. When an item is open, its immediate children
- in the hierarchy become visible on the screen; each child may in turn be
- open or closed, selectively revealing or hiding further parts of the hierarchy.
- When an item is closed, all of its descendants in the hierarchy are hidden. Clicking
- the text of any visible item activates the item, causing the viewer application to
- jump to a destination or trigger an action associated with the item.
- </para>
- <para>
- <classname>Zend_Pdf</classname> class provides public property
- <varname>$outlines</varname> which is an array of
- <classname>Zend_Pdf_Outline</classname> objects.
- <programlisting language="php"><![CDATA[
- $pdf = Zend_Pdf::load($path);
- // Remove outline item
- unset($pdf->outlines[0]->childOutlines[1]);
- // Set Outline to be displayed in bold
- $pdf->outlines[0]->childOutlines[3]->setIsBold(true);
- // Add outline entry
- $pdf->outlines[0]->childOutlines[5]->childOutlines[] =
- Zend_Pdf_Outline::create('Chapter 2', 'chapter_2');
- $pdf->save($path, true);
- ]]></programlisting>
- </para>
- <para>
- Outline attributes may be retrieved or set using the following methods:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>string getTitle()</methodname> - get outline item title.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setTitle(string $title)</methodname> - set outline item title.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>boolean isOpen()</methodname> - true if outline is open
- by default.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setIsOpen(boolean $isOpen)</methodname> - set isOpen state.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>boolean isItalic()</methodname> - true if outline item
- is displayed in italic.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setIsItalic(boolean $isItalic)</methodname> - set
- isItalic state.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>boolean isBold()</methodname> - true if outline item
- is displayed in bold.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setIsBold(boolean $isBold)</methodname> - set
- isBold state.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>Zend_Pdf_Color_Rgb getColor()</methodname> - get outline
- text color (null means black).
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setColor(Zend_Pdf_Color_Rgb $color)</methodname> - set
- outline text color (null means black).
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>Zend_Pdf_Target getTarget()</methodname> - get outline
- target (action or explicit or named destination object).
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setTarget(Zend_Pdf_Target|string $target)</methodname> - set
- outline target (action or destination). String may be used to identify
- named destination. Null means 'no target'.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>array getOptions()</methodname> - get outline attributes
- as an array.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setOptions(array $options)</methodname> - set outline options.
- The following options are recognized: 'title', 'open', 'color', 'italic',
- 'bold', and 'target'.
- </para>
- </listitem>
- </itemizedlist>
- <para>
- New outline may be created in two ways:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>Zend_Pdf_Outline::create(string $title[, Zend_Pdf_Target|string $target])</methodname>
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>Zend_Pdf_Outline::create(array $options)</methodname>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- Each outline object may have child outline items listed in
- <varname>Zend_Pdf_Outline::$childOutlines</varname> public property.
- It's an array of <classname>Zend_Pdf_Outline</classname> objects,
- so outlines are organized in a tree.
- </para>
- <para>
- <classname>Zend_Pdf_Outline</classname> class implements RecursiveArray interface,
- so child outlines may be recursively iterated using RecursiveIteratorIterator:
- <programlisting language="php"><![CDATA[
- $pdf = Zend_Pdf::load($path);
- foreach ($pdf->outlines as $documentRootOutlineEntry) {
- $iterator = new RecursiveIteratorIterator($documentRootOutlineEntry,
- RecursiveIteratorIterator::SELF_FIRST);
- foreach ($iterator as $childOutlineItem) {
- $OutlineItemTarget = $childOutlineItem->getTarget();
- if ($OutlineItemTarget instanceof Zend_Pdf_Destination) {
- if ($pdf->resolveDestination($OutlineItemTarget) === null) {
- // Mark Outline item with unresolvable destination using RED color
- $childOutlineItem->setColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
- }
- } else if ($OutlineItemTarget instanceof Zend_Pdf_Action_GoTo) {
- if ($pdf->resolveDestination($OutlineItemTarget->setDestination()) === null) {
- // Mark Outline item with unresolvable destination using RED color
- $childOutlineItem->setColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
- }
- }
- }
- }
- $pdf->save($path, true);
- ]]></programlisting>
- </para>
- <note>
- <para>
- All outline items with unresolved destinations (or destinations of GoTo
- actions) are updated while document saving by setting their targets to null.
- So document will not be corrupted by removing pages referenced by outlines.
- </para>
- </note>
- </sect2>
- <sect2 id="zend.pdf.pages.interactive-features.annotations">
- <title>Annotations</title>
- <para>
- An annotation associates an object such as a note, sound, or movie with a location
- on a page of a PDF document, or provides a way to interact with the user by means
- of the mouse and keyboard.
- </para>
- <para>
- All annotations are represented by <classname>Zend_Pdf_Annotation</classname>
- abstract class.
- </para>
- <para>
- Annotation may be attached to a page using
- <methodname>Zend_Pdf_Page::attachAnnotation(Zend_Pdf_Annotation $annotation)</methodname>
- method.
- </para>
- <para>
- Three types of annotations may be created by user now:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>Zend_Pdf_Annotation_Link::create($x1, $y1, $x2, $y2, $target)</methodname>
- where <varname>$target</varname> is an action object or a destination or
- string (which may be used in place of named destination object).
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>Zend_Pdf_Annotation_Text::create($x1, $y1, $x2, $y2, $text)</methodname>
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>Zend_Pdf_Annotation_FileAttachment::create($x1, $y1, $x2, $y2, $fileSpecification)</methodname>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- A link annotation represents either a hypertext link to a destination elsewhere in
- the document or an action to be performed.
- </para>
- <para>
- A text annotation represents a "sticky note" attached to a point in the PDF document.
- </para>
- <para>
- A file attachment annotation contains a reference to a file.
- </para>
- <para>
- The following methods are shared between all annotation types:
- </para>
- <itemizedlist>
- <listitem>
- <para><methodname>setLeft(float $left)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>float getLeft()</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>setRight(float $right)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>float getRight()</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>setTop(float $top)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>float getTop()</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>setBottom(float $bottom)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>float getBottom()</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>setText(string $text)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>string getText()</methodname></para>
- </listitem>
- </itemizedlist>
- <para>
- Text annotation property is a text to be displayed for the annotation or, if this
- type of annotation does not display text, an alternate description of the annotation’s
- contents in human-readable form.
- </para>
- <para>
- Link annotation objects also provide two additional methods:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setDestination(Zend_Pdf_Target|string $target)</methodname>
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>Zend_Pdf_Target getDestination()</methodname>
- </para>
- </listitem>
- </itemizedlist>
- </sect2>
- </sect1>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|