punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
Mushrooming Monks,
Time flies like an arrow. Fruit flies like a banana.
After quite some Googling of "perl extract text from pdf" and a host of related permutations, I've concluded that good old pdftotext (part of XPDF) is the best way to go when all you want is a plain text string out of a PDF file. (Including a Perlmonks post by the author of perl module CAM saying so)
BUT - how, exactly, do I use it in my perl script?
That is, if I have foo.pdf in a directory on my server, and my own csript extract_text_from_pdf.pl in my cgi-bin, what is the correct syntax for
but let's not get unreasonable....$content = some-pdftotext-command('foo.pdf'); <code> Then, what I really want is just the first line of text - that is, the + title at the top of the page - but I'm guessing it's not going to co +nveniently insert carriage returns that I can recognize - or will it? <p> So even better would be <code> @lines = = some-other-pdftotext-command('foo.pdf');
Thanks.
Time flies like an arrow. Fruit flies like a banana.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to invoke pdftotext and extract first line of text from PDF file?
by LanX (Saint) on Mar 28, 2010 at 23:23 UTC | |
by brycen (Monk) on Mar 29, 2010 at 05:21 UTC | |
Re: How to invoke pdftotext and extract first line of text from PDF file?
by punch_card_don (Curate) on Mar 28, 2010 at 23:18 UTC |
Back to
Seekers of Perl Wisdom