Graphics Programs Reference
In-Depth Information
pdftk input.pdf attach_files file1.xls file2.xls output output.pdf
The attachment is added to the end of the list of file-level attachments. To add an
attachment at the page level, use the to_page keyword:
pdftk input.pdf attach_files file1.xls to_page 4 output output.pdf
To extract the attachments from a document, writing them to a given directory, we can
use the unpack_files keyword:
pdftk input.pdf unpack_files output outputs/
This writes the attachments, under their original filenames, in the outputs directory.
Encryption and Decryption
Pdftk has facilities for reading encrypted files, and for encrypting the output file.
Decrypting Input Files
The input_pw keyword can be used to specify owner passwords for the input file(s). The
passwords are associated with the inputs by using handles, as with page ranges. If no
handles are given, the passwords are assumed to be given in the same order as the input
files. If the user password is given instead, most pdftk features will not be available,
because the PDF security model would prevent it.
For example, to merge two files which are encrypted, the passwords can be provided
thus:
pdftk file1.pdf file2.pdf input_pw fred charles output out.pdf
Here, “ fred ” is the password for file1.pdf , “ charles ” the password for file2.pdf .
Encrypting the Output
Pdftk can encrypt the output using the 40-bit or 128-bit RC4 encryption methods using
the encrypt_40bit and encrypt_128bit keywords. We can specify the owner and user
passwords using the owner_pw and user_pw keywords. For example, to encrypt a file
with 128-bit encryption using an owner password, but the blank user password:
pdftk input.pdf output output.pdf encrypt_128bit owner_pw fred
Notice we leave out the user_pw keyword to indicate a blank user password.
We have not yet specified the operations to be allowed when the user password is
entered. This can be done by using the allow keyword with one or more of the per-
missions (corresponding to those enumerated in Chapter 8 ):
Printing
DegradedPrinting
ModifyContents
Search WWH ::




Custom Search