Hi Monks. I am using WWW::Mechanize::Firefox to sequentially get documents from a list of URLs. Within each document I search for a specific string. If found, I skip to the next URL. If not found I print document and then get the next URL in the list. I use the
$t = $mech->text;
method to extract the document text to search. Here's the problem: some of the documents are PDFs. As of release 19 Firefox has a built-in PDF viewer. Although Mechanize says ->text only works for HTML, when I use the print $mech->content_type;
method it returns the value "text/HTML" for the PDF document. I was surprised that $mech->text returned anything but it did. However, the $mech->text method returned only the first two pages of the PDF and my search string could be anywhere in the document.
Is there some other way to get the content of a PDF? Can I pass the $mech object to another PDF module (most want to read the PDF from a file)? Can I tweak the text method (I really do not have the skill to do this anyway)? Should I save the PDF to a file first and use, say, CAM::PDF to read the PDF page by page?
I appreciate any/all help. Thanks for taking the time to read this.