1PDF::API2::Annotation(3U)ser Contributed Perl DocumentatiPoDnF::API2::Annotation(3)
2
3
4

NAME

6       PDF::API2::Annotation - Add annotations to a PDF
7

SYNOPSIS

9           my $pdf = PDF::API2->new();
10           my $font = $pdf->font('Helvetica');
11           my $page1 = $pdf->page();
12           my $page2 = $pdf->page();
13
14           my $content = $page1->text();
15           my $message = 'Go to Page 2';
16           my $size = 18;
17           $content->distance(1 * 72, 9 * 72);
18           $content->font($font, $size);
19           $content->text($message);
20
21           my $annotation = $page1->annotation();
22           my $width = $content->text_width($message);
23           $annotation->rect(1 * 72, 9 * 72, 1 * 72 + $width, 9 * 72 + $size);
24           $annotation->link($page2);
25
26           $pdf->save('sample.pdf');
27

METHODS

29   Annotation Types
30       link
31
32           $annotation = $annotation->link($destination, $location, @args);
33
34       Link the annotation to another page in this PDF.  $location and @args
35       are optional and set which part of the page should be displayed, as
36       defined in "destination" in PDF::API2::NamedDestination.
37
38       $destination can be either a PDF::API2::Page object or the name of a
39       named destination defined elsewhere.
40
41       url
42
43           $annotation = $annotation->uri($uri);
44
45       Launch $uri -- typically a web page -- when the annotation is selected.
46
47       file
48
49           $annotation = $annotation->launch($file);
50
51       Open $file when the annotation is selected.
52
53       pdf
54
55           $annotation = $annotation->pdf($file, $page_number, $location, @args);
56
57       Open the PDF file located at $file to the specified page number.
58       $location and @args are optional and set which part of the page should
59       be displayed, as defined in "destination" in
60       PDF::API2::NamedDestination.
61
62       text
63
64           $annotation = $annotation->text($text);
65
66       Define the annotation as a text note with the specified content.
67
68       movie
69
70           $annotation = $annotation->movie($filename, $content_type);
71
72       Embed and link to the movie located at $filename with the specified
73       MIME type.
74
75   Common Annotation Attributes
76       rect
77
78           $annotation = $annotation->rect($llx, $lly, $urx, $ury);
79
80       Define the rectangle around the annotation.
81
82       border
83
84           $annotation = $annotation->border($h_radius, $v_radius, $width);
85
86       Define the border style.  Defaults to 0, 0, 0 (no border).
87
88       content
89
90           $annotation = $annotation->content(@lines);
91
92       Define the text content of the annotation, if applicable.
93
94       open
95
96           $annotation = $annotation->open($boolean);
97
98       Set the annotation to initially be either open or closed.  Only
99       relevant for text annotations.
100
101
102
103perl v5.34.0                      2022-01-21          PDF::API2::Annotation(3)
Impressum