Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^5: Mechanize Firefox text Method

by afoken (Parson)
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="http://www.example.com/pics/hello.gif" 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?

Alexander

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


Comment on Re^5: Mechanize Firefox text Method
Select or Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-12-20 15:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (96 votes), past polls