Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

PDF::API2::Annotation

Name PDF::API2::Annotation
Version 2.043
Located at /usr/local/share/perl5
File /usr/local/share/perl5/PDF/API2/Annotation.pm
Is Core No
Search CPAN for this module PDF::API2::Annotation
Documentation PDF::API2::Annotation
Module Details PDF::API2::Annotation

NAME

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


SYNOPSIS

    my $pdf = PDF::API2->new();
    my $font = $pdf->font('Helvetica');
    my $page1 = $pdf->page();
    my $page2 = $pdf->page();
    my $content = $page1->text();
    my $message = 'Go to Page 2';
    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('sample.pdf');


METHODS

Annotation Types

link

    $annotation = $annotation->link($destination, $location, @args);

Link the annotation to another page in this PDF. $location and @args are optional and set which part of the page should be displayed, as defined in destination in the PDF::API2::NamedDestination manpage.

$destination can be either a the PDF::API2::Page manpage object or the name of a named destination defined elsewhere.

url

    $annotation = $annotation->uri($uri);

Launch $uri -- typically a web page -- when the annotation is selected.

file

    $annotation = $annotation->launch($file);

Open $file when the annotation is selected.

pdf

    $annotation = $annotation->pdf($file, $page_number, $location, @args);

Open the PDF file located at $file to the specified page number. $location and @args are optional and set which part of the page should be displayed, as defined in destination in the PDF::API2::NamedDestination manpage.

text

    $annotation = $annotation->text($text);

Define the annotation as a text note with the specified content.

movie

    $annotation = $annotation->movie($filename, $content_type);

Embed and link to the movie located at $filename with the specified MIME type.

Common Annotation Attributes

rect

    $annotation = $annotation->rect($llx, $lly, $urx, $ury);

Define the rectangle around the annotation.

border

    $annotation = $annotation->border($h_radius, $v_radius, $width);

Define the border style. Defaults to 0, 0, 0 (no border).

content

    $annotation = $annotation->content(@lines);

Define the text content of the annotation, if applicable.

open

    $annotation = $annotation->open($boolean);

Set the annotation to initially be either open or closed. Only relevant for text annotations.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024