in reply to Re^2: PDF-API2 Basic Question
in thread PDF-API2 Basic Question
The following code works. You need to define the media size and the font on the 2nd page.
#!/usr/bin/perl -w use strict; use PDF::API2; my $pdf=PDF::API2->new; # Create a new top-level PDF document my $font = $pdf->corefont('Helvetica'); my ($page, $text); $page=$pdf->page(); # Create 1st page $page->mediabox(500, 700); # Set the page dimensions $text=$page->text(); $text->translate(50, 650); # Position the text $text->font($font,12); $text->text("Page 1"); $page=$pdf->page(2); # Create 2nd page $page=$pdf->openpage(2); $page->mediabox(500, 700); # Set the page dimensions for 2nd page $text=$page->text(); $text->font($font,12); # Set font on the 2nd page $text->translate(50, 640); # Position the text $text->text("Page 2"); $pdf->saveas("file.pdf"); $pdf->end;
|
|---|