aka_bk has asked for the wisdom of the Perl Monks concerning the following question:
Hello, i have a directory 'DAX' with pdf files: adidas Q4.pdf, puma Q1.pdf, nike Q3.pdf. I would like to process them one by one, but i'm having difficulties to call them by the second subroutine.
&open_dir('DAX', '/da/transcripts/DAX'); sub open_dir { $somedir=shift; $dirname=shift; opendir $somedir, $dirname or die 'Cannot open $dirname: $!'; while( $file = readdir $somedir) { print "$file\n" if -T "$dirname/$file"; &build_string($file); } } sub build_string { my $transcript=shift; use CAM::PDF; my $pdf = CAM::PDF->new($transcript); my $page_number=$pdf->numPages(); print "$page_number\n"; for (1..$page_number) { my $text=$pdf->getPageText($_); my $conc_text.=$text; print "$conc_text\n"; } }
What did i do wrong? Thanks in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Processing multiple pdfs using CAM::PDF
by GrandFather (Saint) on Nov 20, 2009 at 04:34 UTC |