Saturday, January 19, 2008

Attach Files to PDFs with pdftk

pdftk can attach files to PDF documents and pages.

When attaching files to an existing PDF, call pdftk like so:

pdftk attach_file \

[to_page ] output

The output filename must be different from the input filename. For example, attach the file data.xls to the first page of the PDF report.pdf like so:

pdftk report.pdf attach_file data.xls to_page 1 output report.page_attachment.pdf

Attach data.xls to report.pdf as a document attachment instead of a page attachment by simply omitting the to_page parameter:

pdftk report.pdf attach_file data.xls output report.doc_attachment.pdf

You can include additional output parameters, too, such as PDF encryption options.

1 comments:

Jack said...

Inspiring post. I had never imagined that we can attach files to pdf using pdftk. First of all I am going to do to see how it works. Thanks a lot for sharing the complete steps to perform this task.
digital signature Adobe Reader