diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to parse a pdf and print the ascii to a file for each match. Currently, I am getting this odd output on console nothing prints to the output file. I verified the data in the pdf can be copy and pasted out with highlighting.
current odd output:
(?-xism:Source IP:.*(\d+.\d+.\d+.\d+))
(?-xism:Request URI: (.*))
(?-xism:HOST: (.*))
current odd output:
(?-xism:Source IP:.*(\d+.\d+.\d+.\d+))
(?-xism:Request URI: (.*))
(?-xism:HOST: (.*))
#!perl use strict; use warnings; use CAM::PDF; my $output_file = 'test.txt'; my $filename = "view.pdf"; my @pdfStrings = ( qr/Source IP:.*(\d+.\d+.\d+.\d+)/, qr/Request URI: +(.*)/, qr/HOST: (.*)/ ); open(my $output_fh, '>', $output_file) or die "Failed to open $output_file - $!"; foreach my $pdfString (@pdfStrings) { my $doc = CAM::PDF->new($filename) || die "Unable to open $filename - + $!"; my $ascii = CAM::PDF->parseAny($pdfString); print $pdfString, "\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: parsing a pdf with CAM::PDF
by daxim (Curate) on Jul 04, 2012 at 18:50 UTC | |
by diamondsandperls (Beadle) on Jul 04, 2012 at 18:57 UTC | |
by Athanasius (Archbishop) on Jul 05, 2012 at 04:43 UTC | |
by bulk88 (Priest) on Jul 05, 2012 at 01:03 UTC | |
Re: parsing a pdf with CAM::PDF
by Anonymous Monk on Jul 05, 2012 at 07:39 UTC |
Back to
Seekers of Perl Wisdom