jmlynesjr has asked for the wisdom of the Perl Monks concerning the following question:
This falls into the "There are no five minute jobs" category. This should have been easy...
I have a 9 page PDF file that I want to delete pages 1 and 9 or extract 2..8, often. Both extractPages() and deletePages() fails with the same error below. Any ideas? I also tried PDF::API2, but the install fails with a PadWalker install fail. Thanks for your assistance.
Test Code
#! /usr/bin/perl # Environment: Ubuntu 22.04LTS, Perl 5 version 34 subversion 0 use strict; use warnings; use CAM::PDF; my $pdf = CAM::PDF->new('DX.pdf'); my $np = $pdf->numPages(); print "Number of pages: $np\n"; $pdf->extractPages( 2..8 ); $pdf->cleanoutput('DXout.pdf');
Output and error message
Number of pages: 9 Expected identifier label: 15 % 1 /Parent 1 0 R /MediaBox [ 0 0 ...
James
There's never enough time to do it right, but always enough time to do it over...
Back to
Seekers of Perl Wisdom