in reply to Re^2: Mechanize Firefox text Method
in thread Mechanize Firefox text Method
PDF does not always contain text. I've seen lots of PDF files that were composed of images (scanned texts, no OCR involved). So getting no text or much less text than expected is not always a problem in your code.
PDF is a "postscript print job on steroides". PDF is basically postscript, with lots of addons that aren't really relevant for your problem. Postscript describes how to print a page. Most times, it works roughly in reading order, but neither postscript nor PDF have a problem with a print job that first emits all "A"s, then all "B"s, then all "C"s, and so on. It inflates the print job, and it makes it really hard to extract the original text, and there seems to be software written for exactly this purpose.
I think a much cleaner way is to determinate the URL of the PDF file (using Mechanize), download the PDF file (using LWP or Mechanize), and process the PDF file using tools like pdftotext.
Note that you still need some OCR software for scanned images, pdftotext just extracts text from the PDF file.
Update: There are several commercial OCR programs that can take PDF files (including those composed of scanned images) as input and deliver text or Word documents.
Alexander
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Mechanize Firefox text Method
by fionbarr (Friar) on May 06, 2013 at 18:10 UTC | |
|
Re^4: Mechanize Firefox text Method
by halweitz (Novice) on May 05, 2013 at 16:28 UTC | |
by afoken (Chancellor) on May 05, 2013 at 18:27 UTC | |
by halweitz (Novice) on May 18, 2013 at 03:02 UTC |