Wednesday, January 16, 2008

PDF Encryption with pdftk

You can encrypt any PDF created with pdftk by simply adding encryption parameters after the output filename, like so:

... output
\
[encrypt_40bit | encrypt_128bit] [allow ] \
[owner_pw ] [user_pw ]

Here are the details:

[encrypt_40bit | encrypt_128bit]
Specify an encryption strength. If this strength is not given along with other encryption parameters, it defaults to encrypt_128bit.

[allow ]
List the permissions to grant users. If this section is omitted, no permissions are granted. See Tables Table 5-1 and Table 5-2 for a complete list of available permissions.

[owner_pw ]
Use this combination to set the owner password. It can be omitted; in which case no owner password is set.

[user_pw ]
Use this parameter to set the user password. It can be omitted; in which case no user password is set.

Adding these parameters yields :

pdftk A=in1.pdf B=in2.pdf C=in3.pdf \
cat A1 B1-end C5 output out.pdf \
encrypt_128bit allow CopyContents Printing \
owner_pw ownpass

2 comments:

electronic signature in word said...

Thanks for sharing the information.As you metioned that [encrypt_40bit | encrypt_128bit] specify an encryption strength.But are there more option than 128 bit or is it enough?

DRM Protection said...

Hi Dude,

PDF encryption is a security measure imposed on PDF documents. Depending on the type and level, it can block opening the document entirely or block the user from conducting certain actions, such as printing and copying. Thanks a lot for sharing with us...