[reportlab-users] Allow commenting on a pdf

Gabe Black gabenbecca at gmail.com
Fri Dec 4 23:32:47 EST 2009


On Fri, Dec 4, 2009 at 10:59 AM, Robin Becker <robin at reportlab.com> wrote:

> there is a way to get an encryption dictionary onto a reportlab document.

>

> The code looks like this

>

> from reportlab.lib.pdfencrypt import encryptCanvas

> encryptCanvas(canvas,userPassword='uuuuu',ownerPassword='ooooo',

>              canPrint=1, canModify=1, canCopy=1, canAnnotate=1,

>              strength=40)

>

>

> alternatively you can use an EncryptionFlowable from the same file in a

> platypus story. I haven't tested any of this recently so you may find some

> bugs.


I tried both methods and they do the same results. I looked to see
what properties each would set (when viewed under Adobe's pdf
properties) and it appears that canAnnotate sets "Filling of form
fields" property. The rest set the printing, content copying and
content copying for accessibility properties. Using the owner
password gives you all of the before mentioned properties
(forms,printing,copying) regardless of what you pass in for the
properties -- with the addition of the Page Extraction property. I
even went to the EncryptionFlowable source and messed with the least
significant permission "reserved" bits to see if they made a
difference (no difference).

Investigating further, Adobe does not allow their free reader to
comment on documents unless the Commenting property is set. None of
their free software offerings allows you to set this property. This
causes me to believe that they probably did not release how one would
go about enabling that feature as their intention seems to be to sell
that feature in their commercial software.

So maybe the "canAnnotate" parameter is a misnomer. The Encryption
classes should probably rename that parameter to canFillOutForms or
something similar for clarity.

Darnit, I really wish I would have known about this obstacle that
Adobe has imposed prior to all the development time I spent... oh
well.

Thank you for your reply.
Gabe


More information about the reportlab-users mailing list