[reportlab-users] PDF encryption

Dinu Gherman gherman at darwin.in-berlin.de
Mon Mar 25 16:41:29 EDT 2013


I'm raising this question below again, since there was no response and
with the current activities I'm afraid, it will be forgotten (but I do
not want to raise it as a bug).

Regards,

Dinu


> I'm trying to create an "encrypted" PDF in which users can view all

> pages without knowing any password, but perform certain operations only

> when they have the user password. With the code below from the user

> guide (with minimal changes) I can always even view the content only

> after entering the user password:

>

> from reportlab.lib import pdfencrypt

> from reportlab.pdfgen import canvas

>

> enc = pdfencrypt.StandardEncryption("secret",

> canPrint=False, canCopy=False)

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

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

> c.showPage()

> c.save()

>

> OTOH, the preview of the Python brochure does exactly that, let all

> people see the content, but don't let them copy stuff e.g. without

> a user password. See download on http://brochure.getpython.info

>

> Is there a way to achieve this with reportlab.lib.pdfencrypt?

>

> BTW, there is some space left for a ReportLab ad in the brochure...

> ;-)




More information about the reportlab-users mailing list