#!/usr/local/bin/perl

use PDF::API2;

my $pdf  = PDF::API2->new();
my $page = $pdf->page();
my $pageto = $pdf->page();

my ($xpos, $ypos, $font_size) = (100, 700, 12);
my $text = "click here for the next page";

my $courier = $pdf->corefont('Courier',1); 

$txt = $pageto->text();
$txt->fillcolor(0.8,0,0);
$txt->font($courier, $font_size);

$txt->translate(300, 700); $txt->text_center("the next page");

$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->link($pageto, 
	    -rect   => [$xpos + ($courier->width($text) * $font_size), 
			 $ypos + $font_size,
			 $xpos,
			 $ypos,
			],
	    -border => [0,0,0],
	    -fith => 800
	   );

$pdf->saveas("$0.pdf");
$pdf->end();
