Learning Pdftk by examples

2007 | Filed Under PDF, Tips, How-to, Software | 

Pdftk is a simple tool for doing everyday things with PDF documents. It allows you to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris.

Examples:

Merge PDF Documents
Merge Two or More PDFs into a New Document
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
or (Using Handles):
pdftk A=1.pdf B=2.pdf cat A B output 12.pdf
or (Using Wildcards):
pdftk *.pdf cat output combined.pdf
“cat” is short for concatenate. Pdftk doesn’t retain bookmarks, but it does keep hyperlinks to both destinations within the PDF and to external files or Web sites. Where some other applications point to the wrong destinations for hyperlinks, the links in PDFs combined using pdftk managed to hit each link target perfectly.

Split PDF Pages into a New Document
pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf

Remove Pages from PDF Documents
Remove ‘page 13′ from in1.pdf to create out1.pdf
pdftk in.pdf cat 1-12 14-end output out1.pdf
or (Using Handles):
pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf

Rotate PDF Pages or Documents
Rotate the First Page of a PDF to 90 Degrees Clockwise
pdftk in.pdf cat 1E 2-end output out.pdf
Rotate an Entire PDF Document’s Pages to 180 Degrees
pdftk in.pdf cat 1-end S output out.pdf

Decrypt Input as Necessary (Password Required)

Encrypt Output as Desired

Fill PDF Forms with FDF Data or XFDF Data and/or Flatten Forms

Apply a Background Watermark or a Foreground Stamp

Report on PDF Metrics such as Metadata, Bookmarks, and Page Labels
pdftk mydoc.pdf dump_data output report.txt

Update the PDF Metadata
Using pdftk and a text file, you can change or add metadata to the PDF:
pdftk DocBook_Overview.pdf update_info data.txt output DocBookOverview.pdf

In this usage, the contents of the file data.txt consist of an InfoKey and InfoValue pair, like this:
InfoKey: Keywords
InfoValue: DocBook,writing,documentation,background

You can change only the following metadata items with pdftk: title, author, subject, producer, and keywords.


Here's A Few More Related Posts

Comments

Leave a Reply