I had this script that used to work in order to return the number of pages but it does not seem to work anymore.
Now when I try running it, All I get is the error
please let me know if you see anything wrong
Code:
#!/usr/local/bin/perl -w
use CAM::PDF;
if (defined($ARGV[0]) && -r $ARGV[0] && $ARGV[0] =~ /\.pdf/i) {
my $pdf_file = $ARGV[0];
my $doc = CAM::PDF->new($pdf_file, q{}, q{}, 1) || die "ERROR: $CAM::PDF::errstr\n";
my $size = length $doc->{content};
my $pages = $doc->numPages();
print "$pages\n";
} else {
print qq{ERROR: Unreadable file '$ARGV[0]' or not a pdf\n};
}
Now when I try running it, All I get is the error
please let me know if you see anything wrong
Comment