自己找到了,方便大家,贴出来
#!/usr/bin/perl -w
use CAM::PDF;
use CAM::PDF::PageText;
$infile = $ARGV[0];
#print "the input PDF file is $infile\n";
$outfile = $ARGV[1];
#print "the output TXT file is $outfile\n";
open (OUTFILE, ">>$outfile") or die("cannot open file : $!");
$pdf = CAM::PDF->new($infile) || die "$CAM::PDF::errstr\n";
$num = $pdf->numPages();
foreach $p (1..$num)
{
#print "this is in page $p\n";
$str = $pdf->getPageText($p);
CAM::PDF->asciify(\$str);
print $str;
print OUTFILE "$str\n"; # write to file
}
close (OUTFILE);