Subject: | Can't insert a page in to a PDF with 8 pages |
The below script adds the 9th page at the end instead of between pages 1
and 2. Change the number 8 to a 7 and the insertion occurs properly.
This seems to be a glitch in PDF::API2::Basic::PDF::Pages::add_page() in
the code that keeps there from being too many pages in one container;
look for "if ($#path <= 0 && $m >= 7)".
use PDF::API2;
$pdf = PDF::API2->new;
my $font = $pdf->corefont('Times-Roman');
sub mark {
my ( $page ) = @_;
my $t = $page->text;
$t->font( $font, 10 );
$t->translate( 20, 40 );
$t->text( $pdf->pages );
}
for (1..8) {
mark $pdf->page;
}
mark $pdf->page(2);
$pdf->saveas( "foo.pdf" );