Question

So, I have a .pdf file and I need to be able to determine if it was created by being scanned into a PDF or not. I'm trying to determine if it is a pdf I can display as text or not.

I have PHP & Zend at my disposal. I'm thinking I might be able to use Zend's

$pdf->properties['Producer']

but I'm not 100% sure.

Is there any way to be sure of what kind of .pdf file I'm dealing with?

Was it helpful?

Solution

Sounds difficult to me. There are tons of different "Producer" IDs around, many of which support the generation of PDFs out of any kind of source, be it scanned, coming from a Fax, a word processor or whatnot. There are so many ways to create a PDF file, you'll never be able to trace back what came from where.

If you want to determine whether you can display it as text or not, why not try to extract some actual text from it? If it's scanned (or any other kind of embedded image) it should have none or very little textual content. But then, there's OCR programs that create a scanned PDF that has machine-readable text coming along, too. How do you want to deal with that?

What is your ultimate goal with this?

OTHER TIPS

To determine if the PDF file has been scanned, open it with Adobe Acrobat Reader.

Check if you can select text, this indicates that the document was NOT scanned.

enter image description here

However, if your attempt to select text reverts to a graphic selection box, this indicates that the document was scanned.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top