note
xbmy
<p>Try this, it works well for me, enjoy!</p>
<code>use warnings;
use CAM::PDF;
use CAM::PDF::PageText;
my $infile = "?.pdf"; #the pdf file you want to extract
my $outfile = "out.txt";
open (OUTFILE, ">>out.txt") or die("cannot open file : $!");
my $pdf = CAM::PDF->new($infile) || die "$CAM::PDF::errstr\n";
my $num = $pdf->numPages();
foreach my $p (1..$num) # p present for the page number
{
my $str = $pdf->getPageText($p);
CAM::PDF->asciify(\$str);
print OUTFILE "$str\n"; # write to file
}
close (OUTFILE);</code>
801280
801280