File: Zend_Pdf-InteractiveFeatures.xml

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (1244 lines) | stat: -rw-r--r-- 48,039 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.pdf.interactive-features">
    <title>Interactive Features</title>

    <sect2 id="zend.pdf.pages.interactive-features.destinations">
        <title>Destinations</title>

        <para>
            A destination defines a particular view of a document, consisting of the following
            items:
        </para>

        <itemizedlist>
            <listitem>
                <para>The page of the document to be displayed.</para>
            </listitem>

            <listitem>
                <para>The location of the document window on that page.</para>
            </listitem>

            <listitem>
                <para>The magnification (zoom) factor to use when displaying the page.</para>
            </listitem>
        </itemizedlist>

        <para>
            Destinations may be associated with outline items (<link
            linkend="zend.pdf.pages.interactive-features.outlines">Document
            Outline (bookmarks)</link>), annotations (<link
            linkend="zend.pdf.pages.interactive-features.annotations">Annotations</link>), or
            actions (<link linkend="zend.pdf.pages.interactive-features.actions">Actions</link>).
            In each case, the destination specifies the view of the document to be presented
            when the outline item or annotation is opened or the action is performed. In addition,
            the optional document open action can be specified.
        </para>

        <sect3 id="zend.pdf.pages.interactive-features.destinations.types">
            <title>Supported Destination Types</title>

            <para>
                The following types are supported by <classname>Zend_Pdf</classname> component.
            </para>

            <sect4 id="zend.pdf.pages.interactive-features.destinations.types.zoom">
                <title>Zend_Pdf_Destination_Zoom</title>

                <para>
                    Display the specified page, with the coordinates (left, top) positioned at
                    the upper-left corner of the window and the contents of the page magnified
                    by the factor zoom.
                </para>

                <para>
                    Destination object may be created using
                    <methodname>Zend_Pdf_Destination_Zoom::create($page, $left = null, $top = null,
                        $zoom = null)</methodname>
                    method.
                </para>

                <para>
                    Where:
                </para>

                <itemizedlist>
                    <listitem>
                        <para>
                            <varname>$page</varname> is a destination page
                            (a <classname>Zend_Pdf_Page</classname> object or a page number).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$left</varname> is a left edge of the displayed page (float).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$top</varname> is a top edge of the displayed page (float).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$zoom</varname> is a zoom factor (float).
                        </para>
                    </listitem>
                </itemizedlist>

                <para>
                   <constant>NULL</constant>, specified for <varname>$left</varname>,
                   <varname>$top</varname> or <varname>$zoom</varname> parameter means
                   "current viewer application value".
                </para>

                <para>
                    <classname>Zend_Pdf_Destination_Zoom</classname> class also provides
                    the following methods:
                </para>

                <itemizedlist>
                    <listitem>
                        <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setLeftEdge(float $left)</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setTopEdge(float $top)</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><type>Float</type><methodname>getZoomFactor()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setZoomFactor(float $zoom)</methodname>;</para>
                    </listitem>
                </itemizedlist>
            </sect4>

            <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit">
                <title>Zend_Pdf_Destination_Fit</title>

                <para>
                    Display the specified page, with the coordinates (left, top) positioned at
                    the upper-left corner of the window and the contents of the page magnified
                    by the factor zoom.
                    Display the specified page, with its contents magnified just enough to fit
                    the entire page within the window both horizontally and vertically. If
                    the required horizontal and vertical magnification factors are different, use
                    the smaller of the two, centering the page within the window in the other
                    dimension.
                </para>

                <para>
                    Destination object may be created using
                    <methodname>Zend_Pdf_Destination_Fit::create($page)</methodname>
                    method.
                </para>

                <para>
                    Where <varname>$page</varname> is a destination page
                    (a <classname>Zend_Pdf_Page</classname> object or a page number).
                </para>
            </sect4>

            <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-horizontally">
                <title>Zend_Pdf_Destination_FitHorizontally</title>

                <para>
                    Display the specified page, with the vertical coordinate top positioned at
                    the top edge of the window and the contents of the page magnified just enough
                    to fit the entire width of the page within the window.
                </para>

                <para>
                    Destination object may be created using
                    <methodname>Zend_Pdf_Destination_FitHorizontally::create($page,
                        $top)</methodname> method.
                </para>

                <para>
                    Where:
                </para>

                <itemizedlist>
                    <listitem>
                        <para>
                            <varname>$page</varname> is a destination page
                            (a <classname>Zend_Pdf_Page</classname> object or a page number).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$top</varname> is a top edge of the displayed page
                            (float).
                        </para>
                    </listitem>
                </itemizedlist>

                <para>
                    <classname>Zend_Pdf_Destination_FitHorizontally</classname> class also
                    provides the following methods:
                </para>

                <itemizedlist>
                    <listitem>
                        <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setTopEdge(float $top)</methodname>;</para>
                    </listitem>
                </itemizedlist>
            </sect4>

            <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-vertically">
                <title>Zend_Pdf_Destination_FitVertically</title>

                <para>
                    Display the specified page, with the horizontal coordinate left positioned
                    at the left edge of the window and the contents of the page magnified just
                    enough to fit the entire height of the page within the window.
                </para>

                <para>
                    Destination object may be created using
                    <methodname>Zend_Pdf_Destination_FitVertically::create($page,
                        $left)</methodname> method.
                </para>

                <para>
                    Where:
                </para>

                <itemizedlist>
                    <listitem>
                        <para>
                            <varname>$page</varname> is a destination page
                            (a <classname>Zend_Pdf_Page</classname> object or a page number).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$left</varname> is a left edge of the displayed page
                            (float).
                        </para>
                    </listitem>
                </itemizedlist>

                <para>
                    <classname>Zend_Pdf_Destination_FitVertically</classname> class also
                    provides the following methods:
                </para>

                <itemizedlist>
                    <listitem>
                        <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setLeftEdge(float $left)</methodname>;</para>
                    </listitem>
                </itemizedlist>
            </sect4>

            <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-rectangle">
                <title>Zend_Pdf_Destination_FitRectangle</title>

                <para>
                    Display the specified page, with its contents magnified just enough to fit
                    the rectangle specified by the coordinates left, bottom, right, and top
                    entirely within the window both horizontally and vertically. If the required
                    horizontal and vertical magnification factors are different, use the smaller
                    of the two, centering the rectangle within the window in the other dimension.
                </para>

                <para>
                    Destination object may be created using
                    <methodname>Zend_Pdf_Destination_FitRectangle::create($page, $left, $bottom,
                        $right, $top)</methodname> method.
                </para>

                <para>
                    Where:
                </para>

                <itemizedlist>
                    <listitem>
                        <para>
                            <varname>$page</varname> is a destination page
                            (a <classname>Zend_Pdf_Page</classname> object or a page number).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$left</varname> is a left edge of the displayed page
                            (float).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$bottom</varname> is a bottom edge of the displayed page
                            (float).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$right</varname> is a right edge of the displayed page (float).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$top</varname> is a top edge of the displayed page (float).
                        </para>
                    </listitem>
                </itemizedlist>

                <para>
                    <classname>Zend_Pdf_Destination_FitRectangle</classname> class also
                    provides the following methods:
                </para>

                <itemizedlist>
                    <listitem>
                        <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setLeftEdge(float $left)</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><type>Float</type><methodname>getBottomEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setBottomEdge(float $bottom)</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><type>Float</type><methodname>getRightEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setRightEdge(float $right)</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setTopEdge(float $top)</methodname>;</para>
                    </listitem>
                </itemizedlist>
            </sect4>

            <sect4 id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box">
                <title>Zend_Pdf_Destination_FitBoundingBox</title>

                <para>
                    Display the specified page, with its contents magnified just enough to fit
                    its bounding box entirely within the window both horizontally and vertically.
                    If the required horizontal and vertical magnification factors are different,
                    use the smaller of the two, centering the bounding box within the window in
                    the other dimension.
                </para>

                <para>
                    Destination object may be created using
                    <methodname>Zend_Pdf_Destination_FitBoundingBox::create($page, $left, $bottom,
                        $right, $top)</methodname> method.
                </para>

                <para>
                    Where <varname>$page</varname> is a destination page
                    (a <classname>Zend_Pdf_Page</classname> object or a page number).
                </para>
            </sect4>

            <sect4
                id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-horizontally">
                <title>Zend_Pdf_Destination_FitBoundingBoxHorizontally</title>

                <para>
                    Display the specified page, with the vertical coordinate top positioned at
                    the top edge of the window and the contents of the page magnified just enough
                    to fit the entire width of its bounding box within the window.
                </para>

                <para>
                    Destination object may be created using
                    <methodname>Zend_Pdf_Destination_FitBoundingBoxHorizontally::create($page,
                        $top)</methodname> method.
                </para>

                <para>
                    Where
                </para>

                <itemizedlist>
                    <listitem>
                        <para>
                            <varname>$page</varname> is a destination page
                            (a <classname>Zend_Pdf_Page</classname> object or a page number).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$top</varname> is a top edge of the displayed page
                            (float).
                        </para>
                    </listitem>
                </itemizedlist>

                <para>
                    <classname>Zend_Pdf_Destination_FitBoundingBoxHorizontally</classname> class
                    also provides the following methods:
                </para>

                <itemizedlist>
                    <listitem>
                        <para><type>Float</type><methodname>getTopEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setTopEdge(float $top)</methodname>;</para>
                    </listitem>
                </itemizedlist>
            </sect4>

            <sect4
                id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-vertically">
                <title>Zend_Pdf_Destination_FitBoundingBoxVertically</title>

                <para>
                    Display the specified page, with the horizontal coordinate left positioned at
                    the left edge of the window and the contents of the page magnified just
                    enough to fit the entire height of its bounding box within the window.
                </para>

                <para>
                    Destination object may be created using
                    <methodname>Zend_Pdf_Destination_FitBoundingBoxVertically::create($page,
                        $left)</methodname> method.
                </para>

                <para>
                    Where
                </para>

                <itemizedlist>
                    <listitem>
                        <para>
                            <varname>$page</varname> is a destination page
                            (a <classname>Zend_Pdf_Page</classname> object or a page number).
                        </para>
                    </listitem>

                    <listitem>
                        <para>
                            <varname>$left</varname> is a left edge of the displayed page
                            (float).
                        </para>
                    </listitem>
                </itemizedlist>

                <para>
                    <classname>Zend_Pdf_Destination_FitBoundingBoxVertically</classname> class
                    also provides the following methods:
                </para>

                <itemizedlist>
                    <listitem>
                        <para><type>Float</type><methodname>getLeftEdge()</methodname>;</para>
                    </listitem>

                    <listitem>
                        <para><methodname>setLeftEdge(float $left)</methodname>;</para>
                    </listitem>
                </itemizedlist>
            </sect4>

            <sect4 id="zend.pdf.pages.interactive-features.destinations.types.named">
                <title>Zend_Pdf_Destination_Named</title>

                <para>
                    All destinations listed above are "Explicit Destinations".
                </para>

                <para>
                    In addition to this, <acronym>PDF</acronym> document may contain a dictionary
                    of such destinations which may be used to reference from outside the
                    <acronym>PDF</acronym> (e.g.
                    '<filename>http://www.mycompany.com/document.pdf#chapter3</filename>').
                </para>

                <para>
                    <classname>Zend_Pdf_Destination_Named</classname> objects allow to refer
                    destinations from the document named destinations dictionary.
                </para>

                <para>
                    Named destination object may be created using
                    <methodname>Zend_Pdf_Destination_Named::create(string $name)</methodname>
                    method.
                </para>

                <para>
                    <classname>Zend_Pdf_Destination_Named</classname> class provides the only one
                    additional method:
                </para>

                <para>
                    <type>String</type><methodname>getName()</methodname>;
                </para>
            </sect4>
        </sect3>

        <sect3 id="zend.pdf.pages.interactive-features.destinations.processing">
            <title>Document level destination processing</title>

            <para>
                <classname>Zend_Pdf</classname> class provides a set of destinations processing
                methods.
            </para>

            <para>
                Each destination object (including named destinations) can be resolved using the
                <methodname>resolveDestination($destination)</methodname> method. It returns
                corresponding <classname>Zend_Pdf_Page</classname> object, if destination target
                is found, or <constant>NULL</constant> otherwise.
            </para>

            <para>
                <methodname>Zend_Pdf::resolveDestination()</methodname> method also takes
                an optional boolean parameter <varname>$refreshPageCollectionHashes</varname>,
                which is <constant>TRUE</constant> by default. It forces
                <classname>Zend_Pdf</classname> object to refresh internal page collection hashes
                since document pages list may be updated by user using
                <varname>Zend_Pdf::$pages</varname> property
                (<link linkend="zend.pdf.pages">Working with Pages</link>).
                It may be turned off for performance reasons,
                if it's known that document pages list wasn't changed since last method
                request.
            </para>

            <para>
                Complete list of named destinations can be retrieved using
                <methodname>Zend_Pdf::getNamedDestinations()</methodname> method. It returns
                an array of <classname>Zend_Pdf_Target</classname> objects, which are actually
                either an explicit destination or a GoTo action
                (<link linkend="zend.pdf.pages.interactive-features.actions">Actions</link>).
            </para>

            <para>
                <methodname>Zend_Pdf::getNamedDestination(string $name)</methodname> method returns
                specified named destination (an explicit destination or a GoTo action).
            </para>

            <para>
                <acronym>PDF</acronym> document named destinations dictionary may be updated with
                <methodname>Zend_Pdf::setNamedDestination(string $name, $destination)</methodname>
                method, where <varname>$destination</varname> is either an explicit destination
                (any destination except <classname>Zend_Pdf_Destination_Named</classname>) or
                a GoTo action.
            </para>

            <para>
                If <constant>NULL</constant> is specified in place of
                <varname>$destination</varname>, then specified named destination is removed.
            </para>

            <note>
                <para>
                    Unresolvable named destinations are automatically removed from a document
                    while document saving.
                </para>
            </note>

            <example id="zend.pdf.interactive-features.destinations.example-1">
                <title>Destinations usage example</title>

                <programlisting language="php"><![CDATA[
$pdf = new Zend_Pdf();
$page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
// Page created, but not included into pages list

$pdf->pages[] = $page1;
$pdf->pages[] = $page2;

$destination1 = Zend_Pdf_Destination_Fit::create($page2);
$destination2 = Zend_Pdf_Destination_Fit::create($page3);

// Returns $page2 object
$page = $pdf->resolveDestination($destination1);

// Returns null, page 3 is not included into document yet
$page = $pdf->resolveDestination($destination2);

$pdf->setNamedDestination('Page2', $destination1);
$pdf->setNamedDestination('Page3', $destination2);

// Returns $destination2
$destination = $pdf->getNamedDestination('Page3');

// Returns $destination1
$pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page2'));

// Returns null, page 3 is not included into document yet
$pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page3'));
]]></programlisting>
            </example>
        </sect3>
    </sect2>

    <sect2 id="zend.pdf.pages.interactive-features.actions">
        <title>Actions</title>

        <para>
            Instead of simply jumping to a destination in the document, an annotation or
            outline item can specify an action for the viewer application to perform,
            such as launching an application, playing a sound, or changing an annotation's
            appearance state.
        </para>

        <sect3 id="zend.pdf.pages.interactive-features.actions.types">
            <title>Supported action types</title>

            <para>
                The following action types are recognized while loading <acronym>PDF</acronym>
                document:
            </para>

            <itemizedlist>
                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_GoTo</classname> - go to
                        a destination in the current document.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_GoToR</classname> - go to
                        a destination in another document.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_GoToE</classname> - go to
                        a destination in an embedded file.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_Launch</classname> - launch
                        an application or open or print a document.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_Thread</classname> - begin reading
                        an article thread.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_URI</classname> - resolve a
                        <acronym>URI</acronym>.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_Sound</classname> - play a sound.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_Movie</classname> - play a movie.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_Hide</classname> - hides or shows
                        one or more annotations on the screen.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_Named</classname> - execute an action
                        predefined by the viewer application:
                    </para>

                    <itemizedlist>
                        <listitem>
                            <para>
                                <emphasis>NextPage</emphasis> - Go to the next page
                                of the document.
                            </para>
                        </listitem>

                        <listitem>
                            <para>
                                <emphasis>PrevPage</emphasis> - Go to the previous
                                page of the document.
                            </para>
                        </listitem>

                        <listitem>
                            <para>
                                <emphasis>FirstPage</emphasis> - Go to the first page
                                of the document.
                            </para>
                        </listitem>

                        <listitem>
                            <para>
                                <emphasis>LastPage</emphasis> - Go to the last page
                                of the document.
                            </para>
                        </listitem>
                    </itemizedlist>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_SubmitForm</classname> - send data to
                        a uniform resource locator.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_ResetForm</classname> - set fields
                        to their default values.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_ImportData</classname> - import field
                        values from a file.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_JavaScript</classname> - execute
                        a JavaScript script.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_SetOCGState</classname> - set the state of
                        one or more optional content groups.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_Rendition</classname> - control the
                        playing of multimedia content (begin, stop, pause, or resume
                        a playing rendition).
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_Trans</classname> - update the display
                        of a document, using a transition dictionary.
                    </para>
                </listitem>

                <listitem>
                    <para>
                        <classname>Zend_Pdf_Action_GoTo3DView</classname> - set
                        the current view of a 3D annotation.
                    </para>
                </listitem>
            </itemizedlist>

            <para>
                Only <classname>Zend_Pdf_Action_GoTo</classname> and
                <classname>Zend_Pdf_Action_URI</classname> actions can be created by
                user now.
            </para>

            <para>
                GoTo action object can be created using
                <methodname>Zend_Pdf_Action_GoTo::create($destination)</methodname> method,
                where <varname>$destination</varname> is a
                <classname>Zend_Pdf_Destination</classname> object or a string which can be used
                to identify named destination.
            </para>

            <para>
                <methodname>Zend_Pdf_Action_URI::create($uri[, $isMap])</methodname> method has
                to be used to create a URI action (see <acronym>API</acronym> documentation for the
                details). Optional <varname>$isMap</varname> parameter is set to
                <constant>FALSE</constant> by default.
            </para>

            <para>
                It also supports the following methods:
            </para>
        </sect3>

        <sect3 id="zend.pdf.pages.interactive-features.actions.chaining">
            <title>Actions chaining</title>

            <para>
                Actions objects can be chained using <varname>Zend_Pdf_Action::$next</varname>
                public property.
            </para>

            <para>
                It's an array of <classname>Zend_Pdf_Action</classname> objects, which also
                may have their sub-actions.
            </para>

            <para>
                <classname>Zend_Pdf_Action</classname> class supports RecursiveIterator interface,
                so child actions may be iterated recursively:
            </para>

            <programlisting language="php"><![CDATA[
$pdf = new Zend_Pdf();
$page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
// Page created, but not included into pages list
$page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);

$pdf->pages[] = $page1;
$pdf->pages[] = $page2;

$action1 = Zend_Pdf_Action_GoTo::create(
                            Zend_Pdf_Destination_Fit::create($page2));
$action2 = Zend_Pdf_Action_GoTo::create(
                            Zend_Pdf_Destination_Fit::create($page3));
$action3 = Zend_Pdf_Action_GoTo::create(
                            Zend_Pdf_Destination_Named::create('Chapter1'));
$action4 = Zend_Pdf_Action_GoTo::create(
                            Zend_Pdf_Destination_Named::create('Chapter5'));

$action2->next[] = $action3;
$action2->next[] = $action4;

$action1->next[] = $action2;

$actionsCount = 1; // Note! Iteration doesn't include top level action and
                   // walks through children only
$iterator = new RecursiveIteratorIterator(
                                        $action1,
                                        RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $chainedAction) {
    $actionsCount++;
}

// Prints 'Actions in a tree: 4'
printf("Actions in a tree: %d\n", $actionsCount++);
]]></programlisting>
        </sect3>

        <sect3 id="zend.pdf.pages.interactive-features.actions.open-action">
            <title>Document Open Action</title>

            <para>
                Special open action may be specify a destination to be displayed or an action
                to be performed when the document is opened.
            </para>

            <para>
                <methodname>Zend_Pdf_Target Zend_Pdf::getOpenAction()</methodname> method
                returns current document open action (or <constant>NULL</constant> if open action
                is not set).
            </para>

            <para>
                <methodname>setOpenAction(Zend_Pdf_Target $openAction = null)</methodname>
                method sets document open action or clean it if <varname>$openAction</varname>
                is <constant>NULL</constant>.
            </para>
        </sect3>
    </sect2>

    <sect2 id="zend.pdf.pages.interactive-features.outlines">
        <title>Document Outline (bookmarks)</title>

        <para>
            A PDF document may optionally display a document outline on the screen, allowing
            the user to navigate interactively from one part of the document to another.
            The outline consists of a tree-structured hierarchy of outline items (sometimes
            called bookmarks), which serve as a visual table of contents to display the document's
            structure to the user. The user can interactively open and close individual
            items by clicking them with the mouse. When an item is open, its immediate children
            in the hierarchy become visible on the screen; each child may in turn be
            open or closed, selectively revealing or hiding further parts of the hierarchy.
            When an item is closed, all of its descendants in the hierarchy are hidden. Clicking
            the text of any visible item activates the item, causing the viewer application to
            jump to a destination or trigger an action associated with the item.
        </para>

        <para>
            <classname>Zend_Pdf</classname> class provides public property
            <varname>$outlines</varname> which is an array of
            <classname>Zend_Pdf_Outline</classname> objects.

            <programlisting language="php"><![CDATA[
$pdf = Zend_Pdf::load($path);

// Remove outline item
unset($pdf->outlines[0]->childOutlines[1]);

// Set Outline to be displayed in bold
$pdf->outlines[0]->childOutlines[3]->setIsBold(true);

// Add outline entry
$pdf->outlines[0]->childOutlines[5]->childOutlines[] =
    Zend_Pdf_Outline::create('Chapter 2', 'chapter_2');

$pdf->save($path, true);
]]></programlisting>
        </para>

        <para>
            Outline attributes may be retrieved or set using the following methods:
        </para>

        <itemizedlist>
            <listitem>
                <para>
                    <methodname>string getTitle()</methodname> - get outline item title.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>setTitle(string $title)</methodname> - set outline item title.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>boolean isOpen()</methodname> - <constant>TRUE</constant> if outline
                    is open by default.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>setIsOpen(boolean $isOpen)</methodname> - set isOpen state.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>boolean isItalic()</methodname> - <constant>TRUE</constant> if
                    outline item is displayed in italic.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>setIsItalic(boolean $isItalic)</methodname> - set
                    isItalic state.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>boolean isBold()</methodname> - <constant>TRUE</constant> if outline
                    item is displayed in bold.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>setIsBold(boolean $isBold)</methodname> - set
                    isBold state.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>Zend_Pdf_Color_Rgb getColor()</methodname> - get outline
                    text color (<constant>NULL</constant> means black).
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>setColor(Zend_Pdf_Color_Rgb $color)</methodname> - set
                    outline text color (<constant>NULL</constant> means black).
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>Zend_Pdf_Target getTarget()</methodname> - get outline
                    target (action or explicit or named destination object).
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>setTarget(Zend_Pdf_Target|string $target)</methodname> - set
                    outline target (action or destination). String may be used to identify
                    named destination. <constant>NULL</constant> means 'no target'.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>array getOptions()</methodname> - get outline attributes
                    as an array.
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>setOptions(array $options)</methodname> - set outline options.
                    The following options are recognized: 'title', 'open', 'color', 'italic',
                    'bold', and 'target'.
                </para>
            </listitem>
        </itemizedlist>

        <para>
            New outline may be created in two ways:
        </para>

        <itemizedlist>
            <listitem>
                <para>
                    <methodname>Zend_Pdf_Outline::create(string $title[, Zend_Pdf_Target|string
                        $target])</methodname>
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>Zend_Pdf_Outline::create(array $options)</methodname>
                </para>
            </listitem>
        </itemizedlist>

        <para>
            Each outline object may have child outline items listed in
            <varname>Zend_Pdf_Outline::$childOutlines</varname> public property.
            It's an array of <classname>Zend_Pdf_Outline</classname> objects,
            so outlines are organized in a tree.
        </para>

        <para>
            <classname>Zend_Pdf_Outline</classname> class implements RecursiveArray interface,
            so child outlines may be recursively iterated using RecursiveIteratorIterator:
        </para>

        <programlisting language="php"><![CDATA[
$pdf = Zend_Pdf::load($path);

foreach ($pdf->outlines as $documentRootOutlineEntry) {
    $iterator = new RecursiveIteratorIterator(
                    $documentRootOutlineEntry,
                    RecursiveIteratorIterator::SELF_FIRST
                );
    foreach ($iterator as $childOutlineItem) {
        $OutlineItemTarget = $childOutlineItem->getTarget();
        if ($OutlineItemTarget instanceof Zend_Pdf_Destination) {
            if ($pdf->resolveDestination($OutlineItemTarget) === null) {
                // Mark Outline item with unresolvable destination
                // using RED color
                $childOutlineItem->setColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
            }
        } else if ($OutlineItemTarget instanceof Zend_Pdf_Action_GoTo) {
            $OutlineItemTarget->setDestination();
            if ($pdf->resolveDestination($OutlineItemTarget) === null) {
                // Mark Outline item with unresolvable destination
                // using RED color
                $childOutlineItem->setColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
            }
        }
    }
}

$pdf->save($path, true);
]]></programlisting>

        <note>
            <para>
                All outline items with unresolved destinations (or destinations of GoTo
                actions) are updated while document saving by setting their targets to
                <constant>NULL</constant>. So document will not be corrupted by removing pages
                referenced by outlines.
            </para>
        </note>
    </sect2>

    <sect2 id="zend.pdf.pages.interactive-features.annotations">
        <title>Annotations</title>

        <para>
            An annotation associates an object such as a note, sound, or movie with a location
            on a page of a PDF document, or provides a way to interact with the user by means
            of the mouse and keyboard.
        </para>

        <para>
            All annotations are represented by <classname>Zend_Pdf_Annotation</classname>
            abstract class.
        </para>

        <para>
            Annotation may be attached to a page using
            <methodname>Zend_Pdf_Page::attachAnnotation(Zend_Pdf_Annotation
                $annotation)</methodname> method.
        </para>

        <para>
            Three types of annotations may be created by user now:
        </para>

        <itemizedlist>
            <listitem>
                <para>
                    <methodname>Zend_Pdf_Annotation_Link::create($x1, $y1, $x2, $y2,
                        $target)</methodname> where <varname>$target</varname> is an action object
                    or a destination or string (which may be used in place of named destination
                    object).
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>Zend_Pdf_Annotation_Text::create($x1, $y1, $x2, $y2,
                        $text)</methodname>
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>Zend_Pdf_Annotation_FileAttachment::create($x1, $y1, $x2, $y2,
                        $fileSpecification)</methodname>
                </para>
            </listitem>
        </itemizedlist>

        <para>
            A link annotation represents either a hypertext link to a destination elsewhere in
            the document or an action to be performed.
        </para>

        <para>
            A text annotation represents a "sticky note" attached to a point in the PDF document.
        </para>

        <para>
            A file attachment annotation contains a reference to a file.
        </para>

        <para>
            The following methods are shared between all annotation types:
        </para>

        <itemizedlist>
            <listitem>
                <para><methodname>setLeft(float $left)</methodname></para>
            </listitem>

            <listitem>
                <para><methodname>float getLeft()</methodname></para>
            </listitem>

            <listitem>
                <para><methodname>setRight(float $right)</methodname></para>
            </listitem>

            <listitem>
                <para><methodname>float getRight()</methodname></para>
            </listitem>

            <listitem>
                <para><methodname>setTop(float $top)</methodname></para>
            </listitem>

            <listitem>
                <para><methodname>float getTop()</methodname></para>
            </listitem>

            <listitem>
                <para><methodname>setBottom(float $bottom)</methodname></para>
            </listitem>

            <listitem>
                <para><methodname>float getBottom()</methodname></para>
            </listitem>

            <listitem>
                <para><methodname>setText(string $text)</methodname></para>
            </listitem>

            <listitem>
                <para><methodname>string getText()</methodname></para>
            </listitem>
        </itemizedlist>

        <para>
            Text annotation property is a text to be displayed for the annotation or, if this
            type of annotation does not display text, an alternate description of the annotation's
            contents in human-readable form.
        </para>

        <para>
            Link annotation objects also provide two additional methods:
        </para>

        <itemizedlist>
            <listitem>
                <para>
                    <methodname>setDestination(Zend_Pdf_Target|string $target)</methodname>
                </para>
            </listitem>

            <listitem>
                <para>
                    <methodname>Zend_Pdf_Target getDestination()</methodname>
                </para>
            </listitem>
        </itemizedlist>
    </sect2>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->