Zend_Pdf-InteractiveFeatures.xml 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.pdf.interactive-features">
  4. <title>Interactive Features</title>
  5. <sect2 id="zend.pdf.pages.interactive-features.destinations">
  6. <title>Destinations</title>
  7. <para>
  8. A destination defines a particular view of a document, consisting of the following
  9. items:
  10. </para>
  11. <itemizedlist>
  12. <listitem>
  13. <para>The page of the document to be displayed.</para>
  14. </listitem>
  15. <listitem>
  16. <para>The location of the document window on that page.</para>
  17. </listitem>
  18. <listitem>
  19. <para>The magnification (zoom) factor to use when displaying the page.</para>
  20. </listitem>
  21. </itemizedlist>
  22. <para>
  23. Destinations may be associated with outline items (<link
  24. linkend="zend.pdf.pages.interactive-features.outlines">Document
  25. Outline (bookmarks)</link>), annotations (<link
  26. linkend="zend.pdf.pages.interactive-features.annotations">Annotations</link>), or
  27. actions (<link linkend="zend.pdf.pages.interactive-features.actions">Actions</link>).
  28. In each case, the destination specifies the view of the document to be presented
  29. when the outline item or annotation is opened or the action is performed. In addition,
  30. the optional document open action can be specified.
  31. </para>
  32. <sect3 id="zend.pdf.pages.interactive-features.destinations.types">
  33. <title>Supported Destination Types</title>
  34. <para>
  35. The following types are supported by <classname>Zend_Pdf</classname> component.
  36. </para>
  37. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.zoom">
  38. <title>Zend_Pdf_Destination_Zoom</title>
  39. <para>
  40. Display the specified page, with the coordinates (left, top) positioned at
  41. the upper-left corner of the window and the contents of the page magnified
  42. by the factor zoom.
  43. </para>
  44. <para>
  45. Destination object may be created using
  46. <methodname>Zend_Pdf_Destination_Zoom::create($page, $left = null, $top = null,
  47. $zoom = null)</methodname>
  48. method.
  49. </para>
  50. <para>
  51. Where:
  52. </para>
  53. <itemizedlist>
  54. <listitem>
  55. <para>
  56. <varname>$page</varname> is a destination page
  57. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  58. </para>
  59. </listitem>
  60. <listitem>
  61. <para>
  62. <varname>$left</varname> is a left edge of the displayed page
  63. (float).
  64. </para>
  65. </listitem>
  66. <listitem>
  67. <para>
  68. <varname>$top</varname> is a top edge of the displayed page
  69. (float).
  70. </para>
  71. </listitem>
  72. <listitem>
  73. <para>
  74. <varname>$zoom</varname> is a zoom factor (float).
  75. </para>
  76. </listitem>
  77. </itemizedlist>
  78. <para>
  79. <constant>NULL</constant>, specified for <varname>$left</varname>,
  80. <varname>$top</varname> or <varname>$zoom</varname> parameter means
  81. "current viewer application value".
  82. </para>
  83. <para>
  84. <classname>Zend_Pdf_Destination_Zoom</classname> class also provides
  85. the following methods:
  86. </para>
  87. <itemizedlist>
  88. <listitem>
  89. <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
  90. </listitem>
  91. <listitem>
  92. <para><methodname>setLeftEdge(float $left)</methodname>;</para>
  93. </listitem>
  94. <listitem>
  95. <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
  96. </listitem>
  97. <listitem>
  98. <para><methodname>setTopEdge(float $top)</methodname>;</para>
  99. </listitem>
  100. <listitem>
  101. <para><type>Float</type><methodname>getZoomFactor()</methodname>;</para>
  102. </listitem>
  103. <listitem>
  104. <para><methodname>setZoomFactor(float $zoom)</methodname>;</para>
  105. </listitem>
  106. </itemizedlist>
  107. </sect4>
  108. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit">
  109. <title>Zend_Pdf_Destination_Fit</title>
  110. <para>
  111. Display the specified page, with the coordinates (left, top) positioned at
  112. the upper-left corner of the window and the contents of the page magnified
  113. by the factor zoom.
  114. Display the specified page, with its contents magnified just enough to fit
  115. the entire page within the window both horizontally and vertically. If
  116. the required horizontal and vertical magnification factors are different, use
  117. the smaller of the two, centering the page within the window in the other
  118. dimension.
  119. </para>
  120. <para>
  121. Destination object may be created using
  122. <methodname>Zend_Pdf_Destination_Fit::create($page)</methodname>
  123. method.
  124. </para>
  125. <para>
  126. Where <varname>$page</varname> is a destination page
  127. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  128. </para>
  129. </sect4>
  130. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-horizontally">
  131. <title>Zend_Pdf_Destination_FitHorizontally</title>
  132. <para>
  133. Display the specified page, with the vertical coordinate top positioned at
  134. the top edge of the window and the contents of the page magnified just enough
  135. to fit the entire width of the page within the window.
  136. </para>
  137. <para>
  138. Destination object may be created using
  139. <methodname>Zend_Pdf_Destination_FitHorizontally::create($page,
  140. $top)</methodname> method.
  141. </para>
  142. <para>
  143. Where:
  144. </para>
  145. <itemizedlist>
  146. <listitem>
  147. <para>
  148. <varname>$page</varname> is a destination page
  149. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  150. </para>
  151. </listitem>
  152. <listitem>
  153. <para>
  154. <varname>$top</varname> is a top edge of the displayed page
  155. (float).
  156. </para>
  157. </listitem>
  158. </itemizedlist>
  159. <para>
  160. <classname>Zend_Pdf_Destination_FitHorizontally</classname> class also
  161. provides the following methods:
  162. </para>
  163. <itemizedlist>
  164. <listitem>
  165. <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
  166. </listitem>
  167. <listitem>
  168. <para><methodname>setTopEdge(float $top)</methodname>;</para>
  169. </listitem>
  170. </itemizedlist>
  171. </sect4>
  172. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-vertically">
  173. <title>Zend_Pdf_Destination_FitVertically</title>
  174. <para>
  175. Display the specified page, with the horizontal coordinate left positioned
  176. at the left edge of the window and the contents of the page magnified just
  177. enough to fit the entire height of the page within the window.
  178. </para>
  179. <para>
  180. Destination object may be created using
  181. <methodname>Zend_Pdf_Destination_FitVertically::create($page,
  182. $left)</methodname> method.
  183. </para>
  184. <para>
  185. Where:
  186. </para>
  187. <itemizedlist>
  188. <listitem>
  189. <para>
  190. <varname>$page</varname> is a destination page
  191. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  192. </para>
  193. </listitem>
  194. <listitem>
  195. <para>
  196. <varname>$left</varname> is a left edge of the displayed page
  197. (float).
  198. </para>
  199. </listitem>
  200. </itemizedlist>
  201. <para>
  202. <classname>Zend_Pdf_Destination_FitVertically</classname> class also
  203. provides the following methods:
  204. </para>
  205. <itemizedlist>
  206. <listitem>
  207. <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
  208. </listitem>
  209. <listitem>
  210. <para><methodname>setLeftEdge(float $left)</methodname>;</para>
  211. </listitem>
  212. </itemizedlist>
  213. </sect4>
  214. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-rectangle">
  215. <title>Zend_Pdf_Destination_FitRectangle</title>
  216. <para>
  217. Display the specified page, with its contents magnified just enough to fit
  218. the rectangle specified by the coordinates left, bottom, right, and top
  219. entirely within the window both horizontally and vertically. If the required
  220. horizontal and vertical magnification factors are different, use the smaller
  221. of the two, centering the rectangle within the window in the other dimension.
  222. </para>
  223. <para>
  224. Destination object may be created using
  225. <methodname>Zend_Pdf_Destination_FitRectangle::create($page, $left, $bottom,
  226. $right, $top)</methodname> method.
  227. </para>
  228. <para>
  229. Where:
  230. </para>
  231. <itemizedlist>
  232. <listitem>
  233. <para>
  234. <varname>$page</varname> is a destination page
  235. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  236. </para>
  237. </listitem>
  238. <listitem>
  239. <para>
  240. <varname>$left</varname> is a left edge of the displayed page
  241. (float).
  242. </para>
  243. </listitem>
  244. <listitem>
  245. <para>
  246. <varname>$bottom</varname> is a bottom edge of the displayed page
  247. (float).
  248. </para>
  249. </listitem>
  250. <listitem>
  251. <para>
  252. <varname>$right</varname> is a right edge of the displayed page
  253. (float).
  254. </para>
  255. </listitem>
  256. <listitem>
  257. <para>
  258. <varname>$top</varname> is a top edge of the displayed page
  259. (float).
  260. </para>
  261. </listitem>
  262. </itemizedlist>
  263. <para>
  264. <classname>Zend_Pdf_Destination_FitRectangle</classname> class also
  265. provides the following methods:
  266. </para>
  267. <itemizedlist>
  268. <listitem>
  269. <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
  270. </listitem>
  271. <listitem>
  272. <para><methodname>setLeftEdge(float $left)</methodname>;</para>
  273. </listitem>
  274. <listitem>
  275. <para><type>Float</type><methodname>getBottomEdge()</methodname>;</para>
  276. </listitem>
  277. <listitem>
  278. <para><methodname>setBottomEdge(float $bottom)</methodname>;</para>
  279. </listitem>
  280. <listitem>
  281. <para><type>Float</type><methodname>getRightEdge()</methodname>;</para>
  282. </listitem>
  283. <listitem>
  284. <para><methodname>setRightEdge(float $right)</methodname>;</para>
  285. </listitem>
  286. <listitem>
  287. <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
  288. </listitem>
  289. <listitem>
  290. <para><methodname>setTopEdge(float $top)</methodname>;</para>
  291. </listitem>
  292. </itemizedlist>
  293. </sect4>
  294. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box">
  295. <title>Zend_Pdf_Destination_FitBoundingBox</title>
  296. <para>
  297. Display the specified page, with its contents magnified just enough to fit
  298. its bounding box entirely within the window both horizontally and vertically.
  299. If the required horizontal and vertical magnification factors are different,
  300. use the smaller of the two, centering the bounding box within the window in
  301. the other dimension.
  302. </para>
  303. <para>
  304. Destination object may be created using
  305. <methodname>Zend_Pdf_Destination_FitBoundingBox::create($page, $left, $bottom,
  306. $right, $top)</methodname> method.
  307. </para>
  308. <para>
  309. Where <varname>$page</varname> is a destination page
  310. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  311. </para>
  312. </sect4>
  313. <sect4
  314. id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-horizontally">
  315. <title>Zend_Pdf_Destination_FitBoundingBoxHorizontally</title>
  316. <para>
  317. Display the specified page, with the vertical coordinate top positioned at
  318. the top edge of the window and the contents of the page magnified just enough
  319. to fit the entire width of its bounding box within the window.
  320. </para>
  321. <para>
  322. Destination object may be created using
  323. <methodname>Zend_Pdf_Destination_FitBoundingBoxHorizontally::create($page,
  324. $top)</methodname> method.
  325. </para>
  326. <para>
  327. Where
  328. </para>
  329. <itemizedlist>
  330. <listitem>
  331. <para>
  332. <varname>$page</varname> is a destination page
  333. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  334. </para>
  335. </listitem>
  336. <listitem>
  337. <para>
  338. <varname>$top</varname> is a top edge of the displayed page
  339. (float).
  340. </para>
  341. </listitem>
  342. </itemizedlist>
  343. <para>
  344. <classname>Zend_Pdf_Destination_FitBoundingBoxHorizontally</classname> class
  345. also provides the following methods:
  346. </para>
  347. <itemizedlist>
  348. <listitem>
  349. <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
  350. </listitem>
  351. <listitem>
  352. <para><methodname>setTopEdge(float $top)</methodname>;</para>
  353. </listitem>
  354. </itemizedlist>
  355. </sect4>
  356. <sect4
  357. id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-vertically">
  358. <title>Zend_Pdf_Destination_FitBoundingBoxVertically</title>
  359. <para>
  360. Display the specified page, with the horizontal coordinate left positioned at
  361. the left edge of the window and the contents of the page magnified just
  362. enough to fit the entire height of its bounding box within the window.
  363. </para>
  364. <para>
  365. Destination object may be created using
  366. <methodname>Zend_Pdf_Destination_FitBoundingBoxVertically::create($page,
  367. $left)</methodname> method.
  368. </para>
  369. <para>
  370. Where
  371. </para>
  372. <itemizedlist>
  373. <listitem>
  374. <para>
  375. <varname>$page</varname> is a destination page
  376. (a <classname>Zend_Pdf_Page</classname> object or a page number).
  377. </para>
  378. </listitem>
  379. <listitem>
  380. <para>
  381. <varname>$left</varname> is a left edge of the displayed page
  382. (float).
  383. </para>
  384. </listitem>
  385. </itemizedlist>
  386. <para>
  387. <classname>Zend_Pdf_Destination_FitBoundingBoxVertically</classname> class
  388. also provides the following methods:
  389. </para>
  390. <itemizedlist>
  391. <listitem>
  392. <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
  393. </listitem>
  394. <listitem>
  395. <para><methodname>setLeftEdge(float $left)</methodname>;</para>
  396. </listitem>
  397. </itemizedlist>
  398. </sect4>
  399. <sect4 id="zend.pdf.pages.interactive-features.destinations.types.named">
  400. <title>Zend_Pdf_Destination_Named</title>
  401. <para>
  402. All destinations listed above are "Explicit Destinations".
  403. </para>
  404. <para>
  405. In addition to this, <acronym>PDF</acronym> document may contain a dictionary
  406. of such destinations which may be used to reference from outside the
  407. <acronym>PDF</acronym> (e.g.
  408. '<filename>http://www.mycompany.com/document.pdf#chapter3</filename>').
  409. </para>
  410. <para>
  411. <classname>Zend_Pdf_Destination_Named</classname> objects allow to refer
  412. destinations from the document named destinations dictionary.
  413. </para>
  414. <para>
  415. Named destination object may be created using
  416. <methodname>Zend_Pdf_Destination_Named::create(string $name)</methodname>
  417. method.
  418. </para>
  419. <para>
  420. <classname>Zend_Pdf_Destination_Named</classname> class provides the only one
  421. additional method:
  422. </para>
  423. <para>
  424. <type>String</type><methodname>getName()</methodname>;
  425. </para>
  426. </sect4>
  427. </sect3>
  428. <sect3 id="zend.pdf.pages.interactive-features.destinations.processing">
  429. <title>Document level destination processing</title>
  430. <para>
  431. <classname>Zend_Pdf</classname> class provides a set of destinations processing
  432. methods.
  433. </para>
  434. <para>
  435. Each destination object (including named destinations) can be resolved using the
  436. <methodname>resolveDestination($destination)</methodname> method. It returns
  437. corresponding <classname>Zend_Pdf_Page</classname> object, if destination target
  438. is found, or <constant>NULL</constant> otherwise.
  439. </para>
  440. <para>
  441. <methodname>Zend_Pdf::resolveDestination()</methodname> method also takes
  442. an optional boolean parameter <varname>$refreshPageCollectionHashes</varname>,
  443. which is true by default. It forces <classname>Zend_Pdf</classname> object
  444. to refresh internal page collection hashes since document pages list may be
  445. updated by user using <varname>Zend_Pdf::$pages</varname> property
  446. (<link linkend="zend.pdf.pages">Working with Pages</link>).
  447. It may be turned off for performance reasons,
  448. if it's known that document pages list wasn't changed since last method
  449. request.
  450. </para>
  451. <para>
  452. Complete list of named destinations can be retrieved using
  453. <methodname>Zend_Pdf::getNamedDestinations()</methodname> method. It returns
  454. an array of <classname>Zend_Pdf_Target</classname> objects, which are actually
  455. either an explicit destination or a GoTo action
  456. (<link linkend="zend.pdf.pages.interactive-features.actions">Actions</link>).
  457. </para>
  458. <para>
  459. <methodname>Zend_Pdf::getNamedDestination(string $name)</methodname> method returns
  460. specified named destination (an explicit destination or a GoTo action).
  461. </para>
  462. <para>
  463. <acronym>PDF</acronym> document named destinations dictionary may be updated with
  464. <methodname>Zend_Pdf::setNamedDestination(string $name, $destination)</methodname>
  465. method, where <varname>$destination</varname> is either an explicit destination
  466. (any destination except <classname>Zend_Pdf_Destination_Named</classname>) or
  467. a GoTo action.
  468. </para>
  469. <para>
  470. If <constant>NULL</constant> is specified in place of
  471. <varname>$destination</varname>, then specified named destination is removed.
  472. </para>
  473. <note>
  474. <para>
  475. Unresolvable named destinations are automatically removed from a document
  476. while document saving.
  477. </para>
  478. </note>
  479. <example id="zend.pdf.interactive-features.destinations.example-1">
  480. <title>Destinations usage example</title>
  481. <programlisting language="php"><![CDATA[
  482. $pdf = new Zend_Pdf();
  483. $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  484. $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  485. $page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  486. // Page created, but not included into pages list
  487. $pdf->pages[] = $page1;
  488. $pdf->pages[] = $page2;
  489. $destination1 = Zend_Pdf_Destination_Fit::create($page2);
  490. $destination2 = Zend_Pdf_Destination_Fit::create($page3);
  491. // Returns $page2 object
  492. $page = $pdf->resolveDestination($destination1);
  493. // Returns null, page 3 is not included into document yet
  494. $page = $pdf->resolveDestination($destination2);
  495. $pdf->setNamedDestination('Page2', $destination1);
  496. $pdf->setNamedDestination('Page3', $destination2);
  497. // Returns $destination2
  498. $destination = $pdf->getNamedDestination('Page3');
  499. // Returns $destination1
  500. $pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page2'));
  501. // Returns null, page 3 is not included into document yet
  502. $pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page3'));
  503. ]]></programlisting>
  504. </example>
  505. </sect3>
  506. </sect2>
  507. <sect2 id="zend.pdf.pages.interactive-features.actions">
  508. <title>Actions</title>
  509. <para>
  510. Instead of simply jumping to a destination in the document, an annotation or
  511. outline item can specify an action for the viewer application to perform,
  512. such as launching an application, playing a sound, or changing an annotation's
  513. appearance state.
  514. </para>
  515. <sect3 id="zend.pdf.pages.interactive-features.actions.types">
  516. <title>Supported action types</title>
  517. <para>
  518. The following action types are recognized while loading <acronym>PDF</acronym>
  519. document:
  520. </para>
  521. <itemizedlist>
  522. <listitem>
  523. <para>
  524. <classname>Zend_Pdf_Action_GoTo</classname> - go to
  525. a destination in the current document.
  526. </para>
  527. </listitem>
  528. <listitem>
  529. <para>
  530. <classname>Zend_Pdf_Action_GoToR</classname> - go to
  531. a destination in another document.
  532. </para>
  533. </listitem>
  534. <listitem>
  535. <para>
  536. <classname>Zend_Pdf_Action_GoToE</classname> - go to
  537. a destination in an embedded file.
  538. </para>
  539. </listitem>
  540. <listitem>
  541. <para>
  542. <classname>Zend_Pdf_Action_Launch</classname> - launch
  543. an application or open or print a document.
  544. </para>
  545. </listitem>
  546. <listitem>
  547. <para>
  548. <classname>Zend_Pdf_Action_Thread</classname> - begin reading
  549. an article thread.
  550. </para>
  551. </listitem>
  552. <listitem>
  553. <para>
  554. <classname>Zend_Pdf_Action_URI</classname> - resolve a
  555. <acronym>URI</acronym>.
  556. </para>
  557. </listitem>
  558. <listitem>
  559. <para>
  560. <classname>Zend_Pdf_Action_Sound</classname> - play a sound.
  561. </para>
  562. </listitem>
  563. <listitem>
  564. <para>
  565. <classname>Zend_Pdf_Action_Movie</classname> - play a movie.
  566. </para>
  567. </listitem>
  568. <listitem>
  569. <para>
  570. <classname>Zend_Pdf_Action_Hide</classname> - hides or shows
  571. one or more annotations on the screen.
  572. </para>
  573. </listitem>
  574. <listitem>
  575. <para>
  576. <classname>Zend_Pdf_Action_Named</classname> - execute an action
  577. predefined by the viewer application:
  578. </para>
  579. <itemizedlist>
  580. <listitem>
  581. <para>
  582. <emphasis>NextPage</emphasis> - Go to the next page
  583. of the document.
  584. </para>
  585. </listitem>
  586. <listitem>
  587. <para>
  588. <emphasis>PrevPage</emphasis> - Go to the previous
  589. page of the document.
  590. </para>
  591. </listitem>
  592. <listitem>
  593. <para>
  594. <emphasis>FirstPage</emphasis> - Go to the first page
  595. of the document.
  596. </para>
  597. </listitem>
  598. <listitem>
  599. <para>
  600. <emphasis>LastPage</emphasis> - Go to the last page
  601. of the document.
  602. </para>
  603. </listitem>
  604. </itemizedlist>
  605. </listitem>
  606. <listitem>
  607. <para>
  608. <classname>Zend_Pdf_Action_SubmitForm</classname> - send data to
  609. a uniform resource locator.
  610. </para>
  611. </listitem>
  612. <listitem>
  613. <para>
  614. <classname>Zend_Pdf_Action_ResetForm</classname> - set fields
  615. to their default values.
  616. </para>
  617. </listitem>
  618. <listitem>
  619. <para>
  620. <classname>Zend_Pdf_Action_ImportData</classname> - import field
  621. values from a file.
  622. </para>
  623. </listitem>
  624. <listitem>
  625. <para>
  626. <classname>Zend_Pdf_Action_JavaScript</classname> - execute
  627. a JavaScript script.
  628. </para>
  629. </listitem>
  630. <listitem>
  631. <para>
  632. <classname>Zend_Pdf_Action_SetOCGState</classname> - set the state of
  633. one or more optional content groups.
  634. </para>
  635. </listitem>
  636. <listitem>
  637. <para>
  638. <classname>Zend_Pdf_Action_Rendition</classname> - control the
  639. playing of multimedia content (begin, stop, pause, or resume
  640. a playing rendition).
  641. </para>
  642. </listitem>
  643. <listitem>
  644. <para>
  645. <classname>Zend_Pdf_Action_Trans</classname> - update the display
  646. of a document, using a transition dictionary.
  647. </para>
  648. </listitem>
  649. <listitem>
  650. <para>
  651. <classname>Zend_Pdf_Action_GoTo3DView</classname> - set
  652. the current view of a 3D annotation.
  653. </para>
  654. </listitem>
  655. </itemizedlist>
  656. <para>
  657. Only <classname>Zend_Pdf_Action_GoTo</classname> actions can be created by
  658. user now. It can be done using
  659. <methodname>Zend_Pdf_Action_GoTo::create($destination)</methodname> method,
  660. where <varname>$destination</varname> is a
  661. <classname>Zend_Pdf_Destination</classname> object or string which can be used
  662. to identify named destination.
  663. </para>
  664. <para>
  665. It also supports the following methods:
  666. </para>
  667. </sect3>
  668. <sect3 id="zend.pdf.pages.interactive-features.actions.chaining">
  669. <title>Actions chaining</title>
  670. <para>
  671. Actions objects can be chained using <varname>Zend_Pdf_Action::$next</varname>
  672. public property.
  673. </para>
  674. <para>
  675. It's an array of <classname>Zend_Pdf_Action</classname> objects, which also
  676. may have their sub-actions.
  677. </para>
  678. <para>
  679. <classname>Zend_Pdf_Action</classname> class supports RecursiveIterator interface,
  680. so child actions may be iterated recursively:
  681. </para>
  682. <programlisting language="php"><![CDATA[
  683. $pdf = new Zend_Pdf();
  684. $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  685. $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  686. // Page created, but not included into pages list
  687. $page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
  688. $pdf->pages[] = $page1;
  689. $pdf->pages[] = $page2;
  690. $action1 = Zend_Pdf_Action_GoTo::create(
  691. Zend_Pdf_Destination_Fit::create($page2));
  692. $action2 = Zend_Pdf_Action_GoTo::create(
  693. Zend_Pdf_Destination_Fit::create($page3));
  694. $action3 = Zend_Pdf_Action_GoTo::create(
  695. Zend_Pdf_Destination_Named::create('Chapter1'));
  696. $action4 = Zend_Pdf_Action_GoTo::create(
  697. Zend_Pdf_Destination_Named::create('Chapter5'));
  698. $action2->next[] = $action3;
  699. $action2->next[] = $action4;
  700. $action1->next[] = $action2;
  701. $actionsCount = 1; // Note! Iteration doesn't include top level action and
  702. // walks through children only
  703. $iterator = new RecursiveIteratorIterator(
  704. $action1,
  705. RecursiveIteratorIterator::SELF_FIRST);
  706. foreach ($iterator as $chainedAction) {
  707. $actionsCount++;
  708. }
  709. printf("Actions in a tree: %d\n", $actionsCount++);
  710. ]]></programlisting>
  711. </sect3>
  712. </sect2>
  713. <sect2 id="zend.pdf.pages.interactive-features.outlines">
  714. <title>Document Outline (bookmarks)</title>
  715. <para>
  716. </para>
  717. </sect2>
  718. <sect2 id="zend.pdf.pages.interactive-features.annotations">
  719. <title>Annotations</title>
  720. <para>
  721. </para>
  722. </sect2>
  723. </sect1>
  724. <!--
  725. vim:se ts=4 sw=4 et:
  726. -->