[reportlab-users] Encryption in pdf

Andrea Cappelli a.cappelli at gmail.com
Fri Sep 11 06:48:14 EDT 2009

Il giorno ven, 11/09/2009 alle 10.03 +0100, Robin Becker ha scritto:

> well I tried this

> > from reportlab.pdfgen import canvas

> > from reportlab.lib import pdfencrypt

> > enc=pdfencrypt.StandardEncryption("user_pass","owner_pass",canPrint=0,canCopy=0)

> > def hello(c):

> > c.drawString(100,100,"Frase di test che non dovrebbe essere copiata")

> > c = canvas.Canvas("tpdfenc.pdf",encrypt=enc)

> > hello(c)

> > c.showPage()

> > c.save()


> ie use a user as well as an owner password. The document then asks for a

> password. If you use the user password the print menu entry is missing. At least

> in my acrobat reader. The 1.7 manual says this

Yes, you are right. I try it on a WindowsXp box with Acrobat 9 and
obtain the same result. On ubuntu i use evince reader and i get not
restrictions at all, so i think that these restrictions applies only to
Acrobat Reader because the restrictions are implemented into the reader
and other software doesn't not use it.

So I'm wondering about the effectiveness of the restriction, if they can
be "broken" so easily, but this is maybe i don't know the pdf standard

> If you specify only an owner password then the reader is allowed to

> decrypt it. Seems a bit strange, but that's the way it is.

I try, if you specify only the owner password the pdf opens and
restrictions apply to everyone (on acrobat reader), is my evince reader
that let me do everything

Thank you for the quick reply

More information about the reportlab-users mailing list