Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^5: Mechanize Firefox text Method

by afoken (Abbot)
on May 05, 2013 at 18:27 UTC ( #1032137=note: print w/replies, xml ) Need Help??

in reply to Re^4: Mechanize Firefox text Method
in thread Mechanize Firefox text Method

Let me clarify a bit. Since I can read the documents in the browser I know they contain only text so OCR is not an issue.

I think we have a little communication problem: Sure you can read text displayed in Firefox, because it was rendered from something like <html><body><h1>Hello</h1>. But you can also read text displayed in Firefox that was rendered from something like <html><body><img src="" alt="">. Your computer can't, at least not as easy as you. To extract the text from the latter, you need OCR.

All the documents follow a similar set of templates but the content changes for each.

Any chance to get access to the data before the template engine creates the PDF? Perhaps as XML, JSON, CSV or even HTML?


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

Replies are listed 'Best First'.
Re^6: Mechanize Firefox text Method
by halweitz (Novice) on May 18, 2013 at 03:02 UTC

    Hi Alexander. Thanks for the reply. Instead of using the content method of Mechanize::Firefox I used CAM::PDF to extract the text from each PDF page and then search the text for my filter phrases. The only wrinkle is that I have to save the URL in a file and then load the file into CAM::PDF. When the script ends I get multiple clean up errors about removing a call back on an undefined value. This does not affect the script in any way.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032137]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2018-04-20 02:04 GMT
Find Nodes?
    Voting Booth?