Copy Protected PDFs and PIL

Brett Bowman bnbowman at
Fri Nov 12 21:00:55 CET 2010

To answer various question:

I've tried worker threads, and it kills the thread only and not the program
as a whole.  I could use that as a work-around, but I would prefer something
more direct, in case other problems arise.

Steve Holden -
A traceback sounds like a great idea, but I don't know how to go about it,
or know what is involved.  Could you suggest a tutorial I could follow?

Emile van Sebille -
a Try/Except block was the first thing I tried, and it still dies with a
fatal error, even if I use a generic Except

Robert Kern -
A whoops, good catch.  I meant to say gfx and swftools.  I'm using PIL to
modify the images once I get a PNG from swftools, and I mis-spoke.
The code in question is:

        import gfx
        print "1"
        doc ="pdf", MY_FILE)
        print "2"
        page1 = doc.getPage(1)
        print "3"
        g_img = gfx.ImageList()
        print "4"
        print "5"
        print "6"
        print "7"

which prints the following:

        FATAL PDF disallows copying

Any help or suggestions would be appreciated.


On Thu, Nov 11, 2010 at 12:28 PM, Brett Bowman <bnbowman at> 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?
> Brett Bowman
> Bioinformatics Associate
> Cibus LLC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list