This shows you the differences between the selected revision and the current version of the page.
| links 2007/08/21 20:08 | links 2007/08/23 15:44 current | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| A small example to illustrate links in a PDF | A small example to illustrate links in a PDF | ||
| - | #!/usr/bin/perl | + | <code perl> |
| + | #!/usr/bin/perl | ||
| + | |||
| + | use PDF::API2::Simple; | ||
| + | |||
| + | my $pdf = PDF::API2::Simple->new( | ||
| + | file => '02_links.pdf' | ||
| + | ); | ||
| + | |||
| + | $pdf->add_font('Verdana'); | ||
| + | $pdf->add_page(); | ||
| + | |||
| + | $pdf->link( 'http://search.cpan.org', 'A Hyperlink', | ||
| + | x => ($pdf->width / 2), | ||
| + | y => ($pdf->height / 2), | ||
| + | align => 'left' ); | ||
| + | |||
| + | $pdf->add_page(); | ||
| + | |||
| + | $pdf->link( 'http://perlmonks.org', 'A fine link', | ||
| + | x => ($pdf->width / 2), | ||
| + | y => ($pdf->height / 2), | ||
| + | align => 'center' ); | ||
| + | |||
| + | $pdf->add_page(); | ||
| - | use PDF::API2::Simple; | + | $pdf->link( 'http://pause.perl.org', 'Some other link', |
| - | + | x => ($pdf->width / 2), | |
| - | my $pdf = PDF::API2::Simple->new( | + | y => ($pdf->height / 2), |
| - | file => '02_links.pdf' | + | align => 'right' ); |
| - | ); | + | |
| - | + | $pdf->save(); | |
| - | $pdf->add_font('Verdana'); | + | </code> |
| - | $pdf->add_page(); | + | |
| - | + | ||
| - | $pdf->link( 'http://search.cpan.org', 'A Hyperlink', | + | |
| - | x => ($pdf->width / 2), | + | |
| - | y => ($pdf->height / 2), | + | |
| - | align => 'left' ); | + | |
| - | + | ||
| - | $pdf->add_page(); | + | |
| - | + | ||
| - | $pdf->link( 'http://perlmonks.org', 'A fine link', | + | |
| - | x => ($pdf->width / 2), | + | |
| - | y => ($pdf->height / 2), | + | |
| - | align => 'center' ); | + | |
| - | + | ||
| - | $pdf->add_page(); | + | |
| - | + | ||
| - | $pdf->link( 'http://pause.perl.org', 'Some other link', | + | |
| - | x => ($pdf->width / 2), | + | |
| - | y => ($pdf->height / 2), | + | |
| - | align => 'right' ); | + | |
| - | + | ||
| - | $pdf->save(); | + | |