Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^3: Mechanize Firefox text Method by afoken
in thread Mechanize Firefox text Method by halweitz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (7)
    As of 2014-04-20 09:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (485 votes), past polls