[reportlab-users] PDF encryption

Dinu Gherman gherman at darwin.in-berlin.de
Mon Mar 25 17:50:39 EDT 2013

J. R. Carroll:

> Hmm I take that back... well only part of it...


> from reportlab.lib import pdfencrypt

> from reportlab.pdfgen import canvas


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

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

> c.drawString(100, 100, "Hello World")

> c.showPage()

> c.save()


> This also works (I went back and reread that section (RTFM on myself - that's rare!). It works fine using Adobe Reader in Win7-64bit. No password prompt to view, but cannot copy/print. If you are having problems getting this to work, it might be your renderer - it's a 'standard' that they can decide to or not to follow.

Yes, it seems like an empty user password does the job I described. Now
it looks more obvious to me. But thanks for making it that obvious! ;-)



More information about the reportlab-users mailing list