{
    "content": [
        {
            "type": "text",
            "text": "# PDF::API2::Annotation (perldoc)\n\n## NAME\n\nPDF::API2::Annotation - Add annotations to a PDF\n\n## SYNOPSIS\n\nmy $pdf = PDF::API2->new();\nmy $font = $pdf->font('Helvetica');\nmy $page1 = $pdf->page();\nmy $page2 = $pdf->page();\nmy $content = $page1->text();\nmy $message = 'Go to Page 2';\nmy $size = 18;\n$content->distance(1 * 72, 9 * 72);\n$content->font($font, $size);\n$content->text($message);\nmy $annotation = $page1->annotation();\nmy $width = $content->textwidth($message);\n$annotation->rect(1 * 72, 9 * 72, 1 * 72 + $width, 9 * 72 + $size);\n$annotation->link($page2);\n$pdf->save('sample.pdf');\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **METHODS** (2 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "PDF::API2::Annotation",
        "section": "",
        "mode": "perldoc",
        "summary": "PDF::API2::Annotation - Add annotations to a PDF",
        "synopsis": "my $pdf = PDF::API2->new();\nmy $font = $pdf->font('Helvetica');\nmy $page1 = $pdf->page();\nmy $page2 = $pdf->page();\nmy $content = $page1->text();\nmy $message = 'Go to Page 2';\nmy $size = 18;\n$content->distance(1 * 72, 9 * 72);\n$content->font($font, $size);\n$content->text($message);\nmy $annotation = $page1->annotation();\nmy $width = $content->textwidth($message);\n$annotation->rect(1 * 72, 9 * 72, 1 * 72 + $width, 9 * 72 + $size);\n$annotation->link($page2);\n$pdf->save('sample.pdf');",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Annotation Types",
                        "lines": 37
                    },
                    {
                        "name": "Common Annotation Attributes",
                        "lines": 20
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "PDF::API2::Annotation - Add annotations to a PDF\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "my $pdf = PDF::API2->new();\nmy $font = $pdf->font('Helvetica');\nmy $page1 = $pdf->page();\nmy $page2 = $pdf->page();\n\nmy $content = $page1->text();\nmy $message = 'Go to Page 2';\nmy $size = 18;\n$content->distance(1 * 72, 9 * 72);\n$content->font($font, $size);\n$content->text($message);\n\nmy $annotation = $page1->annotation();\nmy $width = $content->textwidth($message);\n$annotation->rect(1 * 72, 9 * 72, 1 * 72 + $width, 9 * 72 + $size);\n$annotation->link($page2);\n\n$pdf->save('sample.pdf');\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Annotation Types",
                        "content": "link\n$annotation = $annotation->link($destination, $location, @args);\n\nLink the annotation to another page in this PDF. $location and @args are optional and set which\npart of the page should be displayed, as defined in \"destination\" in\nPDF::API2::NamedDestination.\n\n$destination can be either a PDF::API2::Page object or the name of a named destination defined\nelsewhere.\n\nurl\n$annotation = $annotation->uri($uri);\n\nLaunch $uri -- typically a web page -- when the annotation is selected.\n\nfile\n$annotation = $annotation->launch($file);\n\nOpen $file when the annotation is selected.\n\npdf\n$annotation = $annotation->pdf($file, $pagenumber, $location, @args);\n\nOpen the PDF file located at $file to the specified page number. $location and @args are\noptional and set which part of the page should be displayed, as defined in \"destination\" in\nPDF::API2::NamedDestination.\n\ntext\n$annotation = $annotation->text($text);\n\nDefine the annotation as a text note with the specified content.\n\nmovie\n$annotation = $annotation->movie($filename, $contenttype);\n\nEmbed and link to the movie located at $filename with the specified MIME type.\n"
                    },
                    {
                        "name": "Common Annotation Attributes",
                        "content": "rect\n$annotation = $annotation->rect($llx, $lly, $urx, $ury);\n\nDefine the rectangle around the annotation.\n\nborder\n$annotation = $annotation->border($hradius, $vradius, $width);\n\nDefine the border style. Defaults to 0, 0, 0 (no border).\n\ncontent\n$annotation = $annotation->content(@lines);\n\nDefine the text content of the annotation, if applicable.\n\nopen\n$annotation = $annotation->open($boolean);\n\nSet the annotation to initially be either open or closed. Only relevant for text annotations.\n"
                    }
                ]
            }
        }
    }
}