#!/usr/local/bin/perl use PDF::API2; my $pdf = PDF::API2->new(); my $page = $pdf->page(); my ($xpos, $ypos, $font_size) = (100, 700, 12); my $text = "click here for the PDF::API2 homepage"; my $url = "http://pdfapi2.sf.net/"; my $courier = $pdf->corefont('Courier',1); my $txt = $page->text(); $txt->fillcolor(0,0,1); # nice blue links $txt->font($courier, $font_size); $txt->translate($xpos, $ypos); $txt->text($text); my $annot = $page->annotation(); $annot->url($url, (-rect => [$xpos + ($courier->width($text) * $font_size), $ypos + $font_size, $xpos, $ypos, ], -border => [0,0,0], ) ); $pdf->saveas("$0.pdf"); $pdf->end();