.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 .\" ======================================================================== .\" .IX Title "PDF::API2::Annotation 3pm" .TH PDF::API2::Annotation 3pm "2023-09-29" "perl v5.36.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::API2::Annotation \- Add annotations to a PDF .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& my $pdf = PDF::API2\->new(); \& my $font = $pdf\->font(\*(AqHelvetica\*(Aq); \& my $page1 = $pdf\->page(); \& my $page2 = $pdf\->page(); \& \& my $content = $page1\->text(); \& my $message = \*(AqGo to Page 2\*(Aq; \& my $size = 18; \& $content\->distance(1 * 72, 9 * 72); \& $content\->font($font, $size); \& $content\->text($message); \& \& my $annotation = $page1\->annotation(); \& my $width = $content\->text_width($message); \& $annotation\->rect(1 * 72, 9 * 72, 1 * 72 + $width, 9 * 72 + $size); \& $annotation\->link($page2); \& \& $pdf\->save(\*(Aqsample.pdf\*(Aq); .Ve .SH "METHODS" .IX Header "METHODS" .SS "Annotation Types" .IX Subsection "Annotation Types" \fIlink\fR .IX Subsection "link" .PP .Vb 1 \& $annotation = $annotation\->link($destination, $location, @args); .Ve .PP Link the annotation to another page in this \s-1PDF.\s0 \f(CW$location\fR and \f(CW@args\fR are optional and set which part of the page should be displayed, as defined in \&\*(L"destination\*(R" in PDF::API2::NamedDestination. .PP \&\f(CW$destination\fR can be either a PDF::API2::Page object or the name of a named destination defined elsewhere. .PP \fIurl\fR .IX Subsection "url" .PP .Vb 1 \& $annotation = $annotation\->uri($uri); .Ve .PP Launch \f(CW$uri\fR \*(-- typically a web page \*(-- when the annotation is selected. .PP \fIfile\fR .IX Subsection "file" .PP .Vb 1 \& $annotation = $annotation\->launch($file); .Ve .PP Open \f(CW$file\fR when the annotation is selected. .PP \fIpdf\fR .IX Subsection "pdf" .PP .Vb 1 \& $annotation = $annotation\->pdf($file, $page_number, $location, @args); .Ve .PP Open the \s-1PDF\s0 file located at \f(CW$file\fR to the specified page number. \&\f(CW$location\fR and \f(CW@args\fR are optional and set which part of the page should be displayed, as defined in \*(L"destination\*(R" in PDF::API2::NamedDestination. .PP \fItext\fR .IX Subsection "text" .PP .Vb 1 \& $annotation = $annotation\->text($text); .Ve .PP Define the annotation as a text note with the specified content. .PP \fImovie\fR .IX Subsection "movie" .PP .Vb 1 \& $annotation = $annotation\->movie($filename, $content_type); .Ve .PP Embed and link to the movie located at \f(CW$filename\fR with the specified \s-1MIME\s0 type. .SS "Common Annotation Attributes" .IX Subsection "Common Annotation Attributes" \fIrect\fR .IX Subsection "rect" .PP .Vb 1 \& $annotation = $annotation\->rect($llx, $lly, $urx, $ury); .Ve .PP Define the rectangle around the annotation. .PP \fIborder\fR .IX Subsection "border" .PP .Vb 1 \& $annotation = $annotation\->border($h_radius, $v_radius, $width); .Ve .PP Define the border style. Defaults to 0, 0, 0 (no border). .PP \fIcontent\fR .IX Subsection "content" .PP .Vb 1 \& $annotation = $annotation\->content(@lines); .Ve .PP Define the text content of the annotation, if applicable. .PP \fIopen\fR .IX Subsection "open" .PP .Vb 1 \& $annotation = $annotation\->open($boolean); .Ve .PP Set the annotation to initially be either open or closed. Only relevant for text annotations.