Zend_Pdf-InteractiveFeatures.xml 36 KB

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