Zend_Pdf-InteractiveFeatures.xml 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- EN-Revision: 17275 -->
  3. <!-- Reviewed: no -->
  4. <sect1 id="zend.pdf.interactive-features">
  5. <title>Interaktive Features</title>
  6. <sect2 id="zend.pdf.pages.interactive-features.destinations">
  7. <title>Ziele</title>
  8. <para>
  9. Ein Ziel definiert eine spezielle Sicht eines Dokuments, bestehend aus den folgenden
  10. Elementen:
  11. </para>
  12. <itemizedlist>
  13. <listitem>
  14. <para>Die Seite des Dokuments das angezeigt werden soll.</para>
  15. </listitem>
  16. <listitem>
  17. <para>Der Ort des Dokumenten Fensters auf dieser Seite.</para>
  18. </listitem>
  19. <listitem>
  20. <para>
  21. Der Zoom Faktor der verwendet werden soll wenn die Seite angezeigt wird.
  22. </para>
  23. </listitem>
  24. </itemizedlist>
  25. <para>
  26. Ziele können mit Outline Elementen ((<link
  27. linkend="zend.pdf.pages.interactive-features.outlines">Document Outline
  28. (bookmarks)</link>), Hinweisen (<link
  29. linkend="zend.pdf.pages.interactive-features.annotations">Annotations</link>), oder
  30. Aktionen (<link linkend="zend.pdf.pages.interactive-features.actions">Actions</link>)
  31. verknüpft werden. In jedem Fall spezifiziert das Ziel die Sicht des Dokuments welche
  32. dargestellt werden soll wenn das Outline Element oder der Hinweis geöffnet, oder die
  33. Aktion durchgeführt werden soll. Zusätzlich kann eine optionale Dokument Öffnungs-Aktion
  34. spezifiziert werden.
  35. </para>
  36. <sect3 id="zend.pdf.pages.interactive-features.destinations.types">
  37. <title>Unterstützte Zieltypen</title>
  38. <para>
  39. Die folgenden Typen werden von der <classname>Zend_Pdf</classname> Komponente
  40. unterstützt.
  41. </para>
  42. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.zoom">
  43. <title>Zend_Pdf_Destination_Zoom</title>
  44. <para>
  45. Zeigt die spezifizierte Seite, mit den Koordinaten (Links, Oben) positioniert
  46. an der oberen-linken Ecke des Fensters und dem Inhalt der Seite vergrößert
  47. auf den Zoom Faktor.
  48. </para>
  49. <para>
  50. Zielobjekte können durch Verwendung der
  51. <methodname>Zend_Pdf_Destination_Zoom::create($page, $left = null, $top = null,
  52. $zoom = null)</methodname> Methode erstellt werden.
  53. </para>
  54. <para>
  55. Wobei:
  56. </para>
  57. <itemizedlist>
  58. <listitem>
  59. <para>
  60. <varname>$page</varname> eine Zielseite ist (ein
  61. <classname>Zend_Pdf_Page</classname> Objekt oder eine Seitennummer).
  62. </para>
  63. </listitem>
  64. <listitem>
  65. <para>
  66. <varname>$left</varname> ist die linke Ecke der angezeigten Seite
  67. (float).
  68. </para>
  69. </listitem>
  70. <listitem>
  71. <para>
  72. <varname>$top</varname> ist eine obere Ecke der angezeigten Seite
  73. (float).
  74. </para>
  75. </listitem>
  76. <listitem>
  77. <para>
  78. <varname>$zoom</varname> ist ein Zoom Faktor (float).
  79. </para>
  80. </listitem>
  81. </itemizedlist>
  82. <para>
  83. <constant>NULL</constant>, wenn es für die <varname>$left</varname>,
  84. <varname>$top</varname> or <varname>$zoom</varname> Parameter spezifiziert wird,
  85. heißt "aktueller Wert der Viewer Anwendung".
  86. </para>
  87. <para>
  88. Die <classname>Zend_Pdf_Destination_Zoom</classname> Klasse bietet die folgenden
  89. Methoden an:
  90. </para>
  91. <itemizedlist>
  92. <listitem>
  93. <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
  94. </listitem>
  95. <listitem>
  96. <para><methodname>setLeftEdge(float $left)</methodname>;</para>
  97. </listitem>
  98. <listitem>
  99. <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
  100. </listitem>
  101. <listitem>
  102. <para><methodname>setTopEdge(float $top)</methodname>;</para>
  103. </listitem>
  104. <listitem>
  105. <para><type>Float</type><methodname>getZoomFactor()</methodname>;</para>
  106. </listitem>
  107. <listitem>
  108. <para><methodname>setZoomFactor(float $zoom)</methodname>;</para>
  109. </listitem>
  110. </itemizedlist>
  111. </sect4>
  112. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit">
  113. <title>Zend_Pdf_Destination_Fit</title>
  114. <para>
  115. Zeigt die spezifizierte Seite an, wobei der Inhalt soweit vergrössert wird,
  116. dass er auf die komplette Seite passt sowohl Horizontal als auch Vertikal im
  117. Fenster. Wenn die benötigten horizontalen und vertikalen Vergrösserungsfaktoren
  118. unterschiedlich sind, wird der kleinere der zwei verwendet, und die Seite im
  119. Fenster mit der anderen Dimension zentriert.
  120. </para>
  121. <para>
  122. Das Zielobjekt kann erstellt werden indem die
  123. <methodname>Zend_Pdf_Destination_Fit::create($page)</methodname> Methode
  124. verwendet wird.
  125. </para>
  126. <para>
  127. Wobei <varname>$page</varname> eine Zielseite ist (ein
  128. <classname>Zend_Pdf_Page</classname> Objekt oder eine Seitennummer).
  129. </para>
  130. </sect4>
  131. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-horizontally">
  132. <title>Zend_Pdf_Destination_FitHorizontally</title>
  133. <para>
  134. Zeigt die spezifizierte Seite, mit den vertikalen Koordinaten an der oberen Ecke
  135. des Fensters positioniert, an und den Inhalt der Seite gerade genug vergrössert
  136. damit die komplette Breite der Seite in das Fenster passt.
  137. </para>
  138. <para>
  139. Das Zielobjekt kann erstellt werden indem die
  140. <methodname>Zend_Pdf_Destination_FitHorizontally::create($page,
  141. $top)</methodname> Methode verwendet wird.
  142. </para>
  143. <para>
  144. Wobei:
  145. </para>
  146. <itemizedlist>
  147. <listitem>
  148. <para>
  149. <varname>$page</varname> ist eine Zielseite
  150. (ein <classname>Zend_Pdf_Page</classname> Objekt oder eine Seitenzahl).
  151. </para>
  152. </listitem>
  153. <listitem>
  154. <para>
  155. <varname>$top</varname> ist die obere Ecke der angezeigten Seite
  156. (float).
  157. </para>
  158. </listitem>
  159. </itemizedlist>
  160. <para>
  161. Die Klasse <classname>Zend_Pdf_Destination_FitHorizontally</classname> bietet
  162. auch die folgenden Methoden:
  163. </para>
  164. <itemizedlist>
  165. <listitem>
  166. <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
  167. </listitem>
  168. <listitem>
  169. <para><methodname>setTopEdge(float $top)</methodname>;</para>
  170. </listitem>
  171. </itemizedlist>
  172. </sect4>
  173. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-vertically">
  174. <title>Zend_Pdf_Destination_FitVertically</title>
  175. <para>
  176. Zeigt die spezifizierte Seite, mit den horizontalen Koordinaten an der oberen
  177. Ecke des Fensters positioniert, an und den Inhalt der Seite gerade genug
  178. vergrössert damit die komplette Höhe der Seite in das Fenster passt.
  179. </para>
  180. <para>
  181. Das Zielobjekt kann erstellt werden indem die
  182. <methodname>Zend_Pdf_Destination_FitVertically::create($page,
  183. $left)</methodname> Methode verwendet wird.
  184. </para>
  185. <para>
  186. Wobei:
  187. </para>
  188. <itemizedlist>
  189. <listitem>
  190. <para>
  191. <varname>$page</varname> ist eine Zielseite
  192. (ein <classname>Zend_Pdf_Page</classname> Objekt oder eine Seitenzahl).
  193. </para>
  194. </listitem>
  195. <listitem>
  196. <para>
  197. <varname>$left</varname> die linke Ecke der angezeigten Seite ist.
  198. (float).
  199. </para>
  200. </listitem>
  201. </itemizedlist>
  202. <para>
  203. Die Klasse <classname>Zend_Pdf_Destination_FitVertically</classname> bietet auch
  204. die folgenden Methoden:
  205. </para>
  206. <itemizedlist>
  207. <listitem>
  208. <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
  209. </listitem>
  210. <listitem>
  211. <para><methodname>setLeftEdge(float $left)</methodname>;</para>
  212. </listitem>
  213. </itemizedlist>
  214. </sect4>
  215. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-rectangle">
  216. <title>Zend_Pdf_Destination_FitRectangle</title>
  217. <para>
  218. Display the specified page, with its contents magnified just enough to fit
  219. the rectangle specified by the coordinates left, bottom, right, and top
  220. entirely within the window both horizontally and vertically. If the required
  221. horizontal and vertical magnification factors are different, use the smaller
  222. of the two, centering the rectangle within the window in the other dimension.
  223. </para>
  224. <para>
  225. Destination object may be created using
  226. <methodname>Zend_Pdf_Destination_FitRectangle::create($page, $left, $bottom,
  227. $right, $top)</methodname> method.
  228. </para>
  229. <para>
  230. Where:
  231. </para>
  232. <itemizedlist>
  233. <listitem>
  234. <para>
  235. <varname>$page</varname> is a destination page
  236. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  237. </para>
  238. </listitem>
  239. <listitem>
  240. <para>
  241. <varname>$left</varname> is a left edge of the displayed page
  242. (float).
  243. </para>
  244. </listitem>
  245. <listitem>
  246. <para>
  247. <varname>$bottom</varname> is a bottom edge of the displayed page
  248. (float).
  249. </para>
  250. </listitem>
  251. <listitem>
  252. <para>
  253. <varname>$right</varname> is a right edge of the displayed page
  254. (float).
  255. </para>
  256. </listitem>
  257. <listitem>
  258. <para>
  259. <varname>$top</varname> is a top edge of the displayed page
  260. (float).
  261. </para>
  262. </listitem>
  263. </itemizedlist>
  264. <para>
  265. <classname>Zend_Pdf_Destination_FitRectangle</classname> class also
  266. provides the following methods:
  267. </para>
  268. <itemizedlist>
  269. <listitem>
  270. <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
  271. </listitem>
  272. <listitem>
  273. <para><methodname>setLeftEdge(float $left)</methodname>;</para>
  274. </listitem>
  275. <listitem>
  276. <para><type>Float</type><methodname>getBottomEdge()</methodname>;</para>
  277. </listitem>
  278. <listitem>
  279. <para><methodname>setBottomEdge(float $bottom)</methodname>;</para>
  280. </listitem>
  281. <listitem>
  282. <para><type>Float</type><methodname>getRightEdge()</methodname>;</para>
  283. </listitem>
  284. <listitem>
  285. <para><methodname>setRightEdge(float $right)</methodname>;</para>
  286. </listitem>
  287. <listitem>
  288. <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
  289. </listitem>
  290. <listitem>
  291. <para><methodname>setTopEdge(float $top)</methodname>;</para>
  292. </listitem>
  293. </itemizedlist>
  294. </sect4>
  295. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box">
  296. <title>Zend_Pdf_Destination_FitBoundingBox</title>
  297. <para>
  298. Display the specified page, with its contents magnified just enough to fit
  299. its bounding box entirely within the window both horizontally and vertically.
  300. If the required horizontal and vertical magnification factors are different,
  301. use the smaller of the two, centering the bounding box within the window in
  302. the other dimension.
  303. </para>
  304. <para>
  305. Destination object may be created using
  306. <methodname>Zend_Pdf_Destination_FitBoundingBox::create($page, $left, $bottom,
  307. $right, $top)</methodname> method.
  308. </para>
  309. <para>
  310. Where <varname>$page</varname> is a destination page
  311. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  312. </para>
  313. </sect4>
  314. <sect4
  315. id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-horizontally">
  316. <title>Zend_Pdf_Destination_FitBoundingBoxHorizontally</title>
  317. <para>
  318. Display the specified page, with the vertical coordinate top positioned at
  319. the top edge of the window and the contents of the page magnified just enough
  320. to fit the entire width of its bounding box within the window.
  321. </para>
  322. <para>
  323. Destination object may be created using
  324. <methodname>Zend_Pdf_Destination_FitBoundingBoxHorizontally::create($page,
  325. $top)</methodname> method.
  326. </para>
  327. <para>
  328. Where
  329. </para>
  330. <itemizedlist>
  331. <listitem>
  332. <para>
  333. <varname>$page</varname> is a destination page
  334. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  335. </para>
  336. </listitem>
  337. <listitem>
  338. <para>
  339. <varname>$top</varname> is a top edge of the displayed page
  340. (float).
  341. </para>
  342. </listitem>
  343. </itemizedlist>
  344. <para>
  345. <classname>Zend_Pdf_Destination_FitBoundingBoxHorizontally</classname> class
  346. also provides the following methods:
  347. </para>
  348. <itemizedlist>
  349. <listitem>
  350. <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
  351. </listitem>
  352. <listitem>
  353. <para><methodname>setTopEdge(float $top)</methodname>;</para>
  354. </listitem>
  355. </itemizedlist>
  356. </sect4>
  357. <sect4
  358. id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-vertically">
  359. <title>Zend_Pdf_Destination_FitBoundingBoxVertically</title>
  360. <para>
  361. Display the specified page, with the horizontal coordinate left positioned at
  362. the left edge of the window and the contents of the page magnified just
  363. enough to fit the entire height of its bounding box within the window.
  364. </para>
  365. <para>
  366. Destination object may be created using
  367. <methodname>Zend_Pdf_Destination_FitBoundingBoxVertically::create($page,
  368. $left)</methodname> method.
  369. </para>
  370. <para>
  371. Where
  372. </para>
  373. <itemizedlist>
  374. <listitem>
  375. <para>
  376. <varname>$page</varname> is a destination page
  377. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  378. </para>
  379. </listitem>
  380. <listitem>
  381. <para>
  382. <varname>$left</varname> is a left edge of the displayed page
  383. (float).
  384. </para>
  385. </listitem>
  386. </itemizedlist>
  387. <para>
  388. <classname>Zend_Pdf_Destination_FitBoundingBoxVertically</classname> class
  389. also provides the following methods:
  390. </para>
  391. <itemizedlist>
  392. <listitem>
  393. <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
  394. </listitem>
  395. <listitem>
  396. <para><methodname>setLeftEdge(float $left)</methodname>;</para>
  397. </listitem>
  398. </itemizedlist>
  399. </sect4>
  400. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.named">
  401. <title>Zend_Pdf_Destination_Named</title>
  402. <para>
  403. All destinations listed above are "Explicit Destinations".
  404. </para>
  405. <para>
  406. In addition to this, <acronym>PDF</acronym> document may contain a dictionary
  407. of such destinations which may be used to reference from outside the
  408. <acronym>PDF</acronym> (e.g.
  409. '<filename>http://www.mycompany.com/document.pdf#chapter3</filename>').
  410. </para>
  411. <para>
  412. <classname>Zend_Pdf_Destination_Named</classname> objects allow to refer
  413. destinations from the document named destinations dictionary.
  414. </para>
  415. <para>
  416. Named destination object may be created using
  417. <methodname>Zend_Pdf_Destination_Named::create(string $name)</methodname>
  418. method.
  419. </para>
  420. <para>
  421. <classname>Zend_Pdf_Destination_Named</classname> class provides the only one
  422. additional method:
  423. </para>
  424. <para>
  425. <type>String</type><methodname>getName()</methodname>;
  426. </para>
  427. </sect4>
  428. </sect3>
  429. <sect3 id="zend.pdf.pages.interactive-features.destinations.processing">
  430. <title>Document level destination processing</title>
  431. <para>
  432. <classname>Zend_Pdf</classname> class provides a set of destinations processing
  433. methods.
  434. </para>
  435. <para>
  436. Each destination object (including named destinations) can be resolved using the
  437. <methodname>resolveDestination($destination)</methodname> method. It returns
  438. corresponding <classname>Zend_Pdf_Page</classname> object, if destination target
  439. is found, or <constant>NULL</constant> otherwise.
  440. </para>
  441. <para>
  442. <methodname>Zend_Pdf::resolveDestination()</methodname> method also takes
  443. an optional boolean parameter <varname>$refreshPageCollectionHashes</varname>,
  444. which is true by default. It forces <classname>Zend_Pdf</classname> object
  445. to refresh internal page collection hashes since document pages list may be
  446. updated by user using <varname>Zend_Pdf::$pages</varname> property
  447. (<link linkend="zend.pdf.pages">Working with Pages</link>).
  448. It may be turned off for performance reasons,
  449. if it's known that document pages list wasn't changed since last method
  450. request.
  451. </para>
  452. <para>
  453. Complete list of named destinations can be retrieved using
  454. <methodname>Zend_Pdf::getNamedDestinations()</methodname> method. It returns
  455. an array of <classname>Zend_Pdf_Target</classname> objects, which are actually
  456. either an explicit destination or a GoTo action
  457. (<link linkend="zend.pdf.pages.interactive-features.actions">Actions</link>).
  458. </para>
  459. <para>
  460. <methodname>Zend_Pdf::getNamedDestination(string $name)</methodname> method returns
  461. specified named destination (an explicit destination or a GoTo action).
  462. </para>
  463. <para>
  464. <acronym>PDF</acronym> document named destinations dictionary may be updated with
  465. <methodname>Zend_Pdf::setNamedDestination(string $name, $destination)</methodname>
  466. method, where <varname>$destination</varname> is either an explicit destination
  467. (any destination except <classname>Zend_Pdf_Destination_Named</classname>) or
  468. a GoTo action.
  469. </para>
  470. <para>
  471. If <constant>NULL</constant> is specified in place of
  472. <varname>$destination</varname>, then specified named destination is removed.
  473. </para>
  474. <note>
  475. <para>
  476. Unresolvable named destinations are automatically removed from a document
  477. while document saving.
  478. </para>
  479. </note>
  480. <example id="zend.pdf.interactive-features.destinations.example-1">
  481. <title>Destinations usage example</title>
  482. <programlisting language="php"><![CDATA[
  483. $pdf = new Zend_Pdf();
  484. $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  485. $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  486. $page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  487. // Page created, but not included into pages list
  488. $pdf->pages[] = $page1;
  489. $pdf->pages[] = $page2;
  490. $destination1 = Zend_Pdf_Destination_Fit::create($page2);
  491. $destination2 = Zend_Pdf_Destination_Fit::create($page3);
  492. // Returns $page2 object
  493. $page = $pdf->resolveDestination($destination1);
  494. // Returns null, page 3 is not included into document yet
  495. $page = $pdf->resolveDestination($destination2);
  496. $pdf->setNamedDestination('Page2', $destination1);
  497. $pdf->setNamedDestination('Page3', $destination2);
  498. // Returns $destination2
  499. $destination = $pdf->getNamedDestination('Page3');
  500. // Returns $destination1
  501. $pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page2'));
  502. // Returns null, page 3 is not included into document yet
  503. $pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page3'));
  504. ]]></programlisting>
  505. </example>
  506. </sect3>
  507. </sect2>
  508. <sect2 id="zend.pdf.pages.interactive-features.actions">
  509. <title>Actions</title>
  510. <para>
  511. Instead of simply jumping to a destination in the document, an annotation or
  512. outline item can specify an action for the viewer application to perform,
  513. such as launching an application, playing a sound, or changing an annotation's
  514. appearance state.
  515. </para>
  516. <sect3 id="zend.pdf.pages.interactive-features.actions.types">
  517. <title>Supported action types</title>
  518. <para>
  519. The following action types are recognized while loading <acronym>PDF</acronym>
  520. document:
  521. </para>
  522. <itemizedlist>
  523. <listitem>
  524. <para>
  525. <classname>Zend_Pdf_Action_GoTo</classname> - go to
  526. a destination in the current document.
  527. </para>
  528. </listitem>
  529. <listitem>
  530. <para>
  531. <classname>Zend_Pdf_Action_GoToR</classname> - go to
  532. a destination in another document.
  533. </para>
  534. </listitem>
  535. <listitem>
  536. <para>
  537. <classname>Zend_Pdf_Action_GoToE</classname> - go to
  538. a destination in an embedded file.
  539. </para>
  540. </listitem>
  541. <listitem>
  542. <para>
  543. <classname>Zend_Pdf_Action_Launch</classname> - launch
  544. an application or open or print a document.
  545. </para>
  546. </listitem>
  547. <listitem>
  548. <para>
  549. <classname>Zend_Pdf_Action_Thread</classname> - begin reading
  550. an article thread.
  551. </para>
  552. </listitem>
  553. <listitem>
  554. <para>
  555. <classname>Zend_Pdf_Action_URI</classname> - resolve a
  556. <acronym>URI</acronym>.
  557. </para>
  558. </listitem>
  559. <listitem>
  560. <para>
  561. <classname>Zend_Pdf_Action_Sound</classname> - play a sound.
  562. </para>
  563. </listitem>
  564. <listitem>
  565. <para>
  566. <classname>Zend_Pdf_Action_Movie</classname> - play a movie.
  567. </para>
  568. </listitem>
  569. <listitem>
  570. <para>
  571. <classname>Zend_Pdf_Action_Hide</classname> - hides or shows
  572. one or more annotations on the screen.
  573. </para>
  574. </listitem>
  575. <listitem>
  576. <para>
  577. <classname>Zend_Pdf_Action_Named</classname> - execute an action
  578. predefined by the viewer application:
  579. </para>
  580. <itemizedlist>
  581. <listitem>
  582. <para>
  583. <emphasis>NextPage</emphasis> - Go to the next page
  584. of the document.
  585. </para>
  586. </listitem>
  587. <listitem>
  588. <para>
  589. <emphasis>PrevPage</emphasis> - Go to the previous
  590. page of the document.
  591. </para>
  592. </listitem>
  593. <listitem>
  594. <para>
  595. <emphasis>FirstPage</emphasis> - Go to the first page
  596. of the document.
  597. </para>
  598. </listitem>
  599. <listitem>
  600. <para>
  601. <emphasis>LastPage</emphasis> - Go to the last page
  602. of the document.
  603. </para>
  604. </listitem>
  605. </itemizedlist>
  606. </listitem>
  607. <listitem>
  608. <para>
  609. <classname>Zend_Pdf_Action_SubmitForm</classname> - send data to
  610. a uniform resource locator.
  611. </para>
  612. </listitem>
  613. <listitem>
  614. <para>
  615. <classname>Zend_Pdf_Action_ResetForm</classname> - set fields
  616. to their default values.
  617. </para>
  618. </listitem>
  619. <listitem>
  620. <para>
  621. <classname>Zend_Pdf_Action_ImportData</classname> - import field
  622. values from a file.
  623. </para>
  624. </listitem>
  625. <listitem>
  626. <para>
  627. <classname>Zend_Pdf_Action_JavaScript</classname> - execute
  628. a JavaScript script.
  629. </para>
  630. </listitem>
  631. <listitem>
  632. <para>
  633. <classname>Zend_Pdf_Action_SetOCGState</classname> - set the state of
  634. one or more optional content groups.
  635. </para>
  636. </listitem>
  637. <listitem>
  638. <para>
  639. <classname>Zend_Pdf_Action_Rendition</classname> - control the
  640. playing of multimedia content (begin, stop, pause, or resume
  641. a playing rendition).
  642. </para>
  643. </listitem>
  644. <listitem>
  645. <para>
  646. <classname>Zend_Pdf_Action_Trans</classname> - update the display
  647. of a document, using a transition dictionary.
  648. </para>
  649. </listitem>
  650. <listitem>
  651. <para>
  652. <classname>Zend_Pdf_Action_GoTo3DView</classname> - set
  653. the current view of a 3D annotation.
  654. </para>
  655. </listitem>
  656. </itemizedlist>
  657. <para>
  658. Only <classname>Zend_Pdf_Action_GoTo</classname> actions can be created by
  659. user now. It can be done using
  660. <methodname>Zend_Pdf_Action_GoTo::create($destination)</methodname> method,
  661. where <varname>$destination</varname> is a
  662. <classname>Zend_Pdf_Destination</classname> object or string which can be used
  663. to identify named destination.
  664. </para>
  665. <para>
  666. It also supports the following methods:
  667. </para>
  668. </sect3>
  669. <sect3 id="zend.pdf.pages.interactive-features.actions.chaining">
  670. <title>Actions chaining</title>
  671. <para>
  672. Actions objects can be chained using <varname>Zend_Pdf_Action::$next</varname>
  673. public property.
  674. </para>
  675. <para>
  676. It's an array of <classname>Zend_Pdf_Action</classname> objects, which also
  677. may have their sub-actions.
  678. </para>
  679. <para>
  680. <classname>Zend_Pdf_Action</classname> class supports RecursiveIterator interface,
  681. so child actions may be iterated recursively:
  682. </para>
  683. <programlisting language="php"><![CDATA[
  684. $pdf = new Zend_Pdf();
  685. $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  686. $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  687. // Page created, but not included into pages list
  688. $page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  689. $pdf->pages[] = $page1;
  690. $pdf->pages[] = $page2;
  691. $action1 = Zend_Pdf_Action_GoTo::create(
  692. Zend_Pdf_Destination_Fit::create($page2));
  693. $action2 = Zend_Pdf_Action_GoTo::create(
  694. Zend_Pdf_Destination_Fit::create($page3));
  695. $action3 = Zend_Pdf_Action_GoTo::create(
  696. Zend_Pdf_Destination_Named::create('Chapter1'));
  697. $action4 = Zend_Pdf_Action_GoTo::create(
  698. Zend_Pdf_Destination_Named::create('Chapter5'));
  699. $action2->next[] = $action3;
  700. $action2->next[] = $action4;
  701. $action1->next[] = $action2;
  702. $actionsCount = 1; // Note! Iteration doesn't include top level action and
  703. // walks through children only
  704. $iterator = new RecursiveIteratorIterator(
  705. $action1,
  706. RecursiveIteratorIterator::SELF_FIRST);
  707. foreach ($iterator as $chainedAction) {
  708. $actionsCount++;
  709. }
  710. printf("Actions in a tree: %d\n", $actionsCount++); // Prints 'Actions in a tree: 4'
  711. ]]></programlisting>
  712. </sect3>
  713. <sect3 id="zend.pdf.pages.interactive-features.actions.open-action">
  714. <title>Document Open Action</title>
  715. <para>
  716. Special open action may be specify a destination to be displayed or an action
  717. to be performed when the document is opened.
  718. </para>
  719. <para>
  720. <methodname>Zend_Pdf_Target Zend_Pdf::getOpenAction()</methodname> method
  721. returns current document open action (or null if open action is not set).
  722. </para>
  723. <para>
  724. <methodname>setOpenAction(Zend_Pdf_Target $openAction = null)</methodname>
  725. method sets document open action or clean it if <varname>$openAction</varname>
  726. is null.
  727. </para>
  728. </sect3>
  729. </sect2>
  730. <sect2 id="zend.pdf.pages.interactive-features.outlines">
  731. <title>Document Outline (bookmarks)</title>
  732. <para>
  733. A PDF document may optionally display a document outline on the screen, allowing
  734. the user to navigate interactively from one part of the document to another.
  735. The outline consists of a tree-structured hierarchy of outline items (sometimes
  736. called bookmarks), which serve as a visual table of contents to display the document’s
  737. structure to the user. The user can interactively open and close individual
  738. items by clicking them with the mouse. When an item is open, its immediate children
  739. in the hierarchy become visible on the screen; each child may in turn be
  740. open or closed, selectively revealing or hiding further parts of the hierarchy.
  741. When an item is closed, all of its descendants in the hierarchy are hidden. Clicking
  742. the text of any visible item activates the item, causing the viewer application to
  743. jump to a destination or trigger an action associated with the item.
  744. </para>
  745. <para>
  746. <classname>Zend_Pdf</classname> class provides public property
  747. <varname>$outlines</varname> which is an array of
  748. <classname>Zend_Pdf_Outline</classname> objects.
  749. <programlisting language="php"><![CDATA[
  750. $pdf = Zend_Pdf::load($path);
  751. // Remove outline item
  752. unset($pdf->outlines[0]->childOutlines[1]);
  753. // Set Outline to be displayed in bold
  754. $pdf->outlines[0]->childOutlines[3]->setIsBold(true);
  755. // Add outline entry
  756. $pdf->outlines[0]->childOutlines[5]->childOutlines[] =
  757. Zend_Pdf_Outline::create('Chapter 2', 'chapter_2');
  758. $pdf->save($path, true);
  759. ]]></programlisting>
  760. </para>
  761. <para>
  762. Outline attributes may be retrieved or set using the following methods:
  763. </para>
  764. <itemizedlist>
  765. <listitem>
  766. <para>
  767. <methodname>string getTitle()</methodname> - get outline item title.
  768. </para>
  769. </listitem>
  770. <listitem>
  771. <para>
  772. <methodname>setTitle(string $title)</methodname> - set outline item title.
  773. </para>
  774. </listitem>
  775. <listitem>
  776. <para>
  777. <methodname>boolean isOpen()</methodname> - true if outline is open
  778. by default.
  779. </para>
  780. </listitem>
  781. <listitem>
  782. <para>
  783. <methodname>setIsOpen(boolean $isOpen)</methodname> - set isOpen state.
  784. </para>
  785. </listitem>
  786. <listitem>
  787. <para>
  788. <methodname>boolean isItalic()</methodname> - true if outline item
  789. is displayed in italic.
  790. </para>
  791. </listitem>
  792. <listitem>
  793. <para>
  794. <methodname>setIsItalic(boolean $isItalic)</methodname> - set
  795. isItalic state.
  796. </para>
  797. </listitem>
  798. <listitem>
  799. <para>
  800. <methodname>boolean isBold()</methodname> - true if outline item
  801. is displayed in bold.
  802. </para>
  803. </listitem>
  804. <listitem>
  805. <para>
  806. <methodname>setIsBold(boolean $isBold)</methodname> - set
  807. isBold state.
  808. </para>
  809. </listitem>
  810. <listitem>
  811. <para>
  812. <methodname>Zend_Pdf_Color_Rgb getColor()</methodname> - get outline
  813. text color (null means black).
  814. </para>
  815. </listitem>
  816. <listitem>
  817. <para>
  818. <methodname>setColor(Zend_Pdf_Color_Rgb $color)</methodname> - set
  819. outline text color (null means black).
  820. </para>
  821. </listitem>
  822. <listitem>
  823. <para>
  824. <methodname>Zend_Pdf_Target getTarget()</methodname> - get outline
  825. target (action or explicit or named destination object).
  826. </para>
  827. </listitem>
  828. <listitem>
  829. <para>
  830. <methodname>setTarget(Zend_Pdf_Target|string $target)</methodname> - set
  831. outline target (action or destination). String may be used to identify
  832. named destination. Null means 'no target'.
  833. </para>
  834. </listitem>
  835. <listitem>
  836. <para>
  837. <methodname>array getOptions()</methodname> - get outline attributes
  838. as an array.
  839. </para>
  840. </listitem>
  841. <listitem>
  842. <para>
  843. <methodname>setOptions(array $options)</methodname> - set outline options.
  844. The following options are recognized: 'title', 'open', 'color', 'italic',
  845. 'bold', and 'target'.
  846. </para>
  847. </listitem>
  848. </itemizedlist>
  849. <para>
  850. New outline may be created in two ways:
  851. </para>
  852. <itemizedlist>
  853. <listitem>
  854. <para>
  855. <methodname>Zend_Pdf_Outline::create(string $title[, Zend_Pdf_Target|string $target])</methodname>
  856. </para>
  857. </listitem>
  858. <listitem>
  859. <para>
  860. <methodname>Zend_Pdf_Outline::create(array $options)</methodname>
  861. </para>
  862. </listitem>
  863. </itemizedlist>
  864. <para>
  865. Each outline object may have child outline items listed in
  866. <varname>Zend_Pdf_Outline::$childOutlines</varname> public property.
  867. It's an array of <classname>Zend_Pdf_Outline</classname> objects,
  868. so outlines are organized in a tree.
  869. </para>
  870. <para>
  871. <classname>Zend_Pdf_Outline</classname> class implements RecursiveArray interface,
  872. so child outlines may be recursively iterated using RecursiveIteratorIterator:
  873. <programlisting language="php"><![CDATA[
  874. $pdf = Zend_Pdf::load($path);
  875. foreach ($pdf->outlines as $documentRootOutlineEntry) {
  876. $iterator = new RecursiveIteratorIterator($documentRootOutlineEntry,
  877. RecursiveIteratorIterator::SELF_FIRST);
  878. foreach ($iterator as $childOutlineItem) {
  879. $OutlineItemTarget = $childOutlineItem->getTarget();
  880. if ($OutlineItemTarget instanceof Zend_Pdf_Destination) {
  881. if ($pdf->resolveDestination($OutlineItemTarget) === null) {
  882. // Mark Outline item with unresolvable destination using RED color
  883. $childOutlineItem->setColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
  884. }
  885. } else if ($OutlineItemTarget instanceof Zend_Pdf_Action_GoTo) {
  886. if ($pdf->resolveDestination($OutlineItemTarget->setDestination()) === null) {
  887. // Mark Outline item with unresolvable destination using RED color
  888. $childOutlineItem->setColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
  889. }
  890. }
  891. }
  892. }
  893. $pdf->save($path, true);
  894. ]]></programlisting>
  895. </para>
  896. <note>
  897. <para>
  898. All outline items with unresolved destinations (or destinations of GoTo
  899. actions) are updated while document saving by setting their targets to null.
  900. So document will not be corrupted by removing pages referenced by outlines.
  901. </para>
  902. </note>
  903. </sect2>
  904. <sect2 id="zend.pdf.pages.interactive-features.annotations">
  905. <title>Annotations</title>
  906. <para>
  907. An annotation associates an object such as a note, sound, or movie with a location
  908. on a page of a PDF document, or provides a way to interact with the user by means
  909. of the mouse and keyboard.
  910. </para>
  911. <para>
  912. All annotations are represented by <classname>Zend_Pdf_Annotation</classname>
  913. abstract class.
  914. </para>
  915. <para>
  916. Annotation may be attached to a page using
  917. <methodname>Zend_Pdf_Page::attachAnnotation(Zend_Pdf_Annotation $annotation)</methodname>
  918. method.
  919. </para>
  920. <para>
  921. Three types of annotations may be created by user now:
  922. </para>
  923. <itemizedlist>
  924. <listitem>
  925. <para>
  926. <methodname>Zend_Pdf_Annotation_Link::create($x1, $y1, $x2, $y2, $target)</methodname>
  927. where <varname>$target</varname> is an action object or a destination or
  928. string (which may be used in place of named destination object).
  929. </para>
  930. </listitem>
  931. <listitem>
  932. <para>
  933. <methodname>Zend_Pdf_Annotation_Text::create($x1, $y1, $x2, $y2, $text)</methodname>
  934. </para>
  935. </listitem>
  936. <listitem>
  937. <para>
  938. <methodname>Zend_Pdf_Annotation_FileAttachment::create($x1, $y1, $x2, $y2, $fileSpecification)</methodname>
  939. </para>
  940. </listitem>
  941. </itemizedlist>
  942. <para>
  943. A link annotation represents either a hypertext link to a destination elsewhere in
  944. the document or an action to be performed.
  945. </para>
  946. <para>
  947. A text annotation represents a "sticky note" attached to a point in the PDF document.
  948. </para>
  949. <para>
  950. A file attachment annotation contains a reference to a file.
  951. </para>
  952. <para>
  953. The following methods are shared between all annotation types:
  954. </para>
  955. <itemizedlist>
  956. <listitem>
  957. <para><methodname>setLeft(float $left)</methodname></para>
  958. </listitem>
  959. <listitem>
  960. <para><methodname>float getLeft()</methodname></para>
  961. </listitem>
  962. <listitem>
  963. <para><methodname>setRight(float $right)</methodname></para>
  964. </listitem>
  965. <listitem>
  966. <para><methodname>float getRight()</methodname></para>
  967. </listitem>
  968. <listitem>
  969. <para><methodname>setTop(float $top)</methodname></para>
  970. </listitem>
  971. <listitem>
  972. <para><methodname>float getTop()</methodname></para>
  973. </listitem>
  974. <listitem>
  975. <para><methodname>setBottom(float $bottom)</methodname></para>
  976. </listitem>
  977. <listitem>
  978. <para><methodname>float getBottom()</methodname></para>
  979. </listitem>
  980. <listitem>
  981. <para><methodname>setText(string $text)</methodname></para>
  982. </listitem>
  983. <listitem>
  984. <para><methodname>string getText()</methodname></para>
  985. </listitem>
  986. </itemizedlist>
  987. <para>
  988. Text annotation property is a text to be displayed for the annotation or, if this
  989. type of annotation does not display text, an alternate description of the annotation’s
  990. contents in human-readable form.
  991. </para>
  992. <para>
  993. Link annotation objects also provide two additional methods:
  994. </para>
  995. <itemizedlist>
  996. <listitem>
  997. <para>
  998. <methodname>setDestination(Zend_Pdf_Target|string $target)</methodname>
  999. </para>
  1000. </listitem>
  1001. <listitem>
  1002. <para>
  1003. <methodname>Zend_Pdf_Target getDestination()</methodname>
  1004. </para>
  1005. </listitem>
  1006. </itemizedlist>
  1007. </sect2>
  1008. </sect1>
  1009. <!--
  1010. vim:se ts=4 sw=4 et:
  1011. -->