i'm new perl , i'm trying read pdf file using cam::pdf
here code:
when try run in command prompt these errors:
"use of uninitialized value in addition <+> @ c:/strawberry/perl/site/lib/cam/pdf.pm line 667 ... substr outside of str @ c:/strawberry/perl/site/lib/cam/pdf.pm line 657 ... (at end)... "bad request object 60 @ position 0 in file can't call method "getpagecontenttree" on undefined value @ c:...
the weird thing have exact same files , program on separate computer runs fine. prints computer can't.
i've tried reinstalling cam::pdf , reinstalling cpan
. reinstall failed reason too. help.
#!/usr/bin/perl use strict; use warnings; use cam::pdf; use cam::pdf::pagetext; #in cmd: courts.pl samplepdf.pdf $filename = shift || die "supply pdf on command line\n"; $pdf = cam::pdf->new($filename); #print text_from_page(1); $string = text_from_page(1); #print $string; $string =~ s/\b \b//g; print $string; open(my $fh, '>', 'reports.txt'); print $fh "$string"; close $fh; print "done\n"; sub text_from_page { $pg_num = shift; return cam::pdf::pagetext->render($pdf->getpagecontenttree($pg_num)); }
Comments
Post a Comment