Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Extract text from PDF (normal text)

by xbmy (Friar)
on Jun 09, 2010 at 21:33 UTC ( [id://843932]=note: print w/replies, xml ) Need Help??


in reply to Extract text from PDF (normal text)

Try this, it works well for me, enjoy!

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);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://843932]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (10)
As of 2024-04-16 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found