# phpman > perldoc > PDF::API2::Annotation

## NAME
    [PDF::API2::Annotation](https://www.chedong.com/phpMan.php/perldoc/PDF%3A%3AAPI2%3A%3AAnnotation/markdown) - Add annotations to a PDF

## SYNOPSIS
        my $pdf = [PDF::API2](https://www.chedong.com/phpMan.php/perldoc/PDF%3A%3AAPI2/markdown)->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
    [PDF::API2::NamedDestination](https://www.chedong.com/phpMan.php/perldoc/PDF%3A%3AAPI2%3A%3ANamedDestination/markdown).

    $destination can be either a [PDF::API2::Page](https://www.chedong.com/phpMan.php/perldoc/PDF%3A%3AAPI2%3A%3APage/markdown) 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
    [PDF::API2::NamedDestination](https://www.chedong.com/phpMan.php/perldoc/PDF%3A%3AAPI2%3A%3ANamedDestination/markdown).

   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.

