Copy Protected PDFs and PIL

Robert Kern robert.kern at gmail.com
Thu Nov 11 18:42:35 EST 2010


On 2010-11-11 14:28 , Brett Bowman wrote:
> I'm trying to parse some basic details and a thumbnail from ~12,000 PDFs for my
> company, but a few hundred of them are copy protected.  To make matters worse, I
> can't seem to trap the error it causes: whenever it happens PIL throws a "FATAL
> PDF disallows copying" message and dies.  An automated way to snap a picture of
> the PDFs would be ideal, but I'd settle for a way to skip over them without
> crashing my program.
>
> Any tips?

I don't think PIL reads PDF files at all. Are you sure that the error comes from 
PIL and not some other piece of software? I would be very surprised if PIL 
simply crashed with such an error message. That is not a situation where a 
well-behaved Python library like PIL would abort without a catchable traceback.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list