1PDF::Builder::Outline(3U)ser Contributed Perl DocumentatiPoDnF::Builder::Outline(3)
2
3
4
6 PDF::Builder::Outline - Manage PDF outlines (a.k.a. bookmarks)
7
9 # Get/create the top-level outline tree
10 my $outlines = $pdf->outline();
11
12 # Add an entry
13 my $item = $outlines->outline();
14 $item->title('First Page');
15 $item->destination($pdf->open_page(1)); # or dest(...)
16
18 $outline = PDF::Builder::Outline->new($api, $parent, $prev)
19 Returns a new outline object (called from $outlines->outline()).
20
21 Examine the Outline Tree
22 $boolean = $outline->has_children()
23 Return true if the current outline item has children (child items).
24
25 $integer = $outline->count()
26 Return the number of descendants that are visible when the current
27 outline item is open (expanded).
28
29 $child = $outline->first()
30 Return the first child of the current outline level, if one exists.
31
32 $child = $outline->last()
33 Return the last child of the current outline level, if one exists.
34
35 $parent = $outline->parent()
36 Return the parent of the current item, if not at the top level of
37 the outline tree.
38
39 $sibling = $outline->prev()
40 Return the previous item of the current level of the outline tree.
41
42 $sibling = $outline->next()
43 Return the next item of the current level of the outline tree.
44
45 Modify the Outline Tree
46 $child_outline = $parent_outline->outline()
47 Returns a new sub-outline (nested outline) added at the end of the
48 current outline's children.
49
50 $sibling = $outline->insert_after()
51 Add an outline item immediately following the current item.
52
53 $sibling = $outline->insert_before()
54 Add an outline item immediately preceding the current item.
55
56 $outline->delete()
57 Remove the current outline item from the outline tree. If the item
58 has any children, they will effectively be deleted as well, since
59 they will no longer be linked.
60
61 $boolean = $outline->is_open() # Get
62 $outline = $outline->is_open($boolean) # Set
63 Get/set whether the outline is expanded (open) or collapsed
64 (closed).
65
66 $outline->open()
67 Set the status of the outline to open (i.e., expanded).
68
69 This is an alternate method to using is_open(true).
70
71 $outline->closed()
72 Set the status of the outline to closed (i.e., collapsed).
73
74 This is an alternate method to using is_open(false).
75
76 Set Outline Attributes
77 $title = $outline->title() # Get
78 $outline = $outline->title($text) # Set
79 Get/set the title of the outline item.
80
81 $outline->dest($page_object, %position)
82 $outline->dest($page_object)
83 Sets the destination page and optional position of the outline.
84
85 %position can be any of those listed in "Page Fit Options" in
86 PDF::Builder::Docs.
87
88 "xyz" is the default fit setting, with position (left and top) and
89 zoom the same as the calling page's.
90
91 $outline->dest($name, %position)
92 $outline->dest($name)
93 Connect the Outline to a "Named Destination" defined elsewhere, and
94 optional positioning as described above.
95
96 $outline = $outline->destination($destination, $location, @args)
97 Set the destination page and optional position of the outline.
98 $location and @args are as defined in "destination" in
99 PDF::Builder::NamedDestination.
100
101 $destination can optionally be the name of a named destination
102 defined elsewhere.
103
104 This is an alternative method for changes made in PDF::API2; it
105 maintains compatibility with the new PDF::API2 version.
106
107 Destination targets
108 $outline->uri($url)
109 Defines the outline as launch-url with url $url, typically a web
110 page.
111
112 Alternate name: "url"
113
114 Either "uri" or "url" may be used; "uri" is for compatibility with
115 PDF::API2.
116
117 $outline->launch($file)
118 Defines the outline as launch-file with filepath $file. This is
119 typically a local application or file.
120
121 Alternate name: "file"
122
123 Either "launch" or "file" may be used; "launch" is for
124 compatibility with PDF::API2.
125
126 $outline->pdf($pdffile, $page_number, %position, %args)
127 $outline->pdf($pdffile, $page_number)
128 Defines the destination of the outline as a PDF-file with filepath
129 $pdffile, on page $pagenum (default 0), and position %position
130 (same as dest()).
131
132 Alternate names: "pdf_file" and "pdfile"
133
134 Either "pdf" or "pdf_file" (or the older "pdfile") may be used;
135 "pdf" is for compatibility with PDF::API2. Note that PDF::API2 now
136 uses a string name for the location, and an array of dimensions,
137 etc., rather than the old hash element name => dimensions (as still
138 used here in PDF::Builder).
139
140
141
142perl v5.36.0 2022-09-13 PDF::Builder::Outline(3)