.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "PDF::Builder::Outline 3" .TH PDF::Builder::Outline 3 2026-02-08 "perl v5.42.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME PDF::Builder::Outline \- Manage PDF outlines (a.k.a. bookmarks) .PP Inherits from PDF::Builder::Basic::PDF::Dict .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& # Get/create the top\-level outline tree \& my $outlines = $pdf\->outline(); \& \& # Add an entry \& my $item = $outlines\->outline(); \& $item\->title(\*(AqFirst Page\*(Aq); \& $item\->dest($pdf\->open_page(1), fit\-def); .Ve .SH METHODS .IX Header "METHODS" .SS new .IX Subsection "new" .Vb 1 \& $outline = PDF::Builder::Outline\->new($api, $parent) \& \& $outline = PDF::Builder::Outline\->new($api) .Ve .Sp .RS 4 Returns a new outline object (called from \f(CW$outlines\fR\->\fBoutline()\fR). .Sp By default, if \f(CW$parent\fR is omitted, the new bookmark is placed at the end of any existing list of bookmarks. Otherwise, it becomes the child of the \f(CW$parent\fR bookmark. .RE .SS "Examine the Outline Tree" .IX Subsection "Examine the Outline Tree" \fIhas_children\fR .IX Subsection "has_children" .PP .Vb 1 \& $boolean = $outline\->has_children() .Ve .Sp .RS 4 Return true if the current outline item has children (child items). .RE .PP \fIcount\fR .IX Subsection "count" .PP .Vb 1 \& $integer = $outline\->count() .Ve .Sp .RS 4 Return the number of descendants that are visible when the current outline item is open (expanded). .RE .PP \fIfirst\fR .IX Subsection "first" .PP .Vb 1 \& $child = $outline\->first() .Ve .Sp .RS 4 Return the first child of the current outline level, if one exists. .RE .PP \fIlast\fR .IX Subsection "last" .PP .Vb 1 \& $child = $outline\->last() .Ve .Sp .RS 4 Return the last child of the current outline level, if one exists. .RE .PP \fIparent\fR .IX Subsection "parent" .PP .Vb 1 \& $parent = $outline\->parent() .Ve .Sp .RS 4 Return the parent of the current item, if not at the top level of the outline tree. .RE .PP \fIprev\fR .IX Subsection "prev" .PP .Vb 1 \& $sibling = $outline\->prev() # Get \& \& $sibling = $outline\->prev(outline_obj) # Set .Ve .Sp .RS 4 Return the previous item of the current level of the outline tree (\f(CW\*(C`undef\*(C'\fR if already at the first item). .RE .PP \fInext\fR .IX Subsection "next" .PP .Vb 1 \& $sibling = $outline\->next() # Get \& \& $sibling = $outline\->next(outline_obj) # Set .Ve .Sp .RS 4 Return the next item of the current level of the outline tree (\f(CW\*(C`undef\*(C'\fR if already at the last item). .RE .SS "Modify the Outline Tree" .IX Subsection "Modify the Outline Tree" \fIoutline\fR .IX Subsection "outline" .PP .Vb 1 \& $child_outline = $parent_outline\->outline() .Ve .Sp .RS 4 Returns a new sub\-outline (nested outline) added at the end of the \&\f(CW$parent_outline\fR\*(Aqs children. If there are no existing children, create the first one. .RE .PP \fIinsert_after\fR .IX Subsection "insert_after" .PP .Vb 1 \& $sibling = $outline\->insert_after() .Ve .Sp .RS 4 Add an outline item immediately following the \f(CW$outline\fR item. .RE .PP \fIinsert_before\fR .IX Subsection "insert_before" .PP .Vb 1 \& $sibling = $outline\->insert_before() .Ve .Sp .RS 4 Add an outline item immediately preceding the \f(CW$outline\fR item. .RE .PP \fIdelete\fR .IX Subsection "delete" .PP .Vb 1 \& $outline\->delete() .Ve .Sp .RS 4 Remove the current outline item from the outline tree. If the item has any children, they will effectively be deleted as well, since they will no longer be linked. .RE .PP \fIis_open\fR .IX Subsection "is_open" .PP .Vb 1 \& $boolean = $outline\->is_open() # Get \& \& $outline = $outline\->is_open($boolean) # Set .Ve .Sp .RS 4 Get/set whether the outline is expanded (open) or collapsed (closed). \&\f(CW$boolean\fR is 0/false to close (collapse) the outline (hide its children), or 1/true to open (expand) it (make its children visible). .RE .PP \fIopen\fR .IX Subsection "open" .PP .Vb 1 \& $outline\->open() .Ve .Sp .RS 4 Set the status of the outline to open (i.e., expanded). .Sp This is an \fBalternate\fR method to using is_open(true). .RE .PP \fIclosed\fR .IX Subsection "closed" .PP .Vb 1 \& $outline\->closed() .Ve .Sp .RS 4 Set the status of the outline to closed (i.e., collapsed). .Sp This is an \fBalternate\fR method to using is_open(false). .RE .SS "Set Outline Attributes" .IX Subsection "Set Outline Attributes" \fItitle\fR .IX Subsection "title" .PP .Vb 1 \& $title = $outline\->title() # Get \& \& $outline = $outline\->title($text) # Set .Ve .Sp .RS 4 Get/set the title of the outline item. .RE .PP \fIdest\fR .IX Subsection "dest" .PP .Vb 1 \& $outline\->dest($page_object, %position) \& \& $outline\->dest($page_object) .Ve .Sp .RS 4 Sets the destination page and optional position of the outline. .Sp \&\f(CW%position\fR can be any of those listed in "Page Fit Options" in PDF::Builder::Docs. .Sp "xyz" is the \fBdefault\fR fit setting, with position (left and top) and zoom the same as the calling page\*(Aqs. .Sp .Vb 1 \& $outline\->dest($name, %position) \& \& $outline\->dest($name) .Ve .Sp Connect the Outline to a "Named Destination" defined elsewhere, and optional positioning as described above. .Sp Note that PDF::Builder\*(Aqs \f(CWdest()\fR is \fBnot\fR the same (i.e., an alias) as PDF::API2\*(Aqs \f(CWdestination()\fR. The argument lists are quite different. .RE .SS "Destination targets" .IX Subsection "Destination targets" \fIuri, url\fR .IX Subsection "uri, url" .PP .Vb 1 \& $outline\->uri($url) .Ve .Sp .RS 4 Defines the outline as launch\-url with url \f(CW$url\fR, typically a web page. .Sp \&\fBAlternate name:\fR \f(CW\*(C`url\*(C'\fR .Sp Either \f(CW\*(C`uri\*(C'\fR or \f(CW\*(C`url\*(C'\fR may be used; \f(CW\*(C`uri\*(C'\fR is for compatibility with PDF::API2. .RE .PP \fIlaunch, file\fR .IX Subsection "launch, file" .PP .Vb 1 \& $outline\->launch($file) .Ve .Sp .RS 4 Defines the outline as launch\-file with filepath \f(CW$file\fR. This is typically a local application or file. .Sp \&\fBAlternate name:\fR \f(CW\*(C`file\*(C'\fR .Sp Either \f(CW\*(C`launch\*(C'\fR or \f(CW\*(C`file\*(C'\fR may be used; \f(CW\*(C`launch\*(C'\fR is for compatibility with PDF::API2. .RE .PP \fIpdf, pdf_file, pdfile\fR .IX Subsection "pdf, pdf_file, pdfile" .PP .Vb 1 \& $outline\->pdf($pdffile, $page_number, %position, %args) \& \& $outline\->pdf($pdffile, $page_number) .Ve .Sp .RS 4 Defines the destination of the outline as a PDF\-file with filepath \&\f(CW$pdffile\fR, on page \f(CW$pagenum\fR (default 0), and position \f(CW%position\fR (same as \fBdest()\fR). .Sp \&\fBAlternate names:\fR \f(CW\*(C`pdf_file\*(C'\fR and \f(CW\*(C`pdfile\*(C'\fR .Sp Either \f(CW\*(C`pdf\*(C'\fR or \f(CW\*(C`pdf_file\*(C'\fR (or the older \f(CW\*(C`pdfile\*(C'\fR) may be used; \f(CW\*(C`pdf\*(C'\fR is for compatibility with PDF::API2. .RE