문제

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?

도움이 되었습니까?

해결책

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?

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top