Subject: | -1 used in importpage() |
Error: Modification of non-creatable array value attempted, subscript -1 at /Library/Perl/5.8.1/PDF/API2.pm line 810.
Appears to be a problem appending a page to end of document when document is new and does not contain any pages yet. Using "1" instead of "-1" for first page avoids this problem. Subsequent pages can be added using "-1".
perl -v: This is perl, v5.8.1-RC3 built for darwin-thread-multi-2level
OS X version 10.3.8
$Id: API2.pm,v 1.79 2005/03/23 16:42:06 fredo Exp $
Modules built via sudo perl -MCPAN -eshell
Thank you for building this incredible toolset!
Sample code:
#!/usr/bin/perl
use warnings;
use strict;
use PDF::API2;
my $pdf = PDF::API2->new(-file => "/Users/djac/Desktop/output.pdf");
my $pdf1 = PDF::API2->open("/Users/djac/Desktop/PDFInserts/mysql.pdf");
$pdf->importpage($pdf1, 1, -1);
$pdf->importpage($pdf1, 2, -1);
$pdf->save;
$pdf->end;
$pdf1->end;
exit;