Sunday, 11 June 2017

PDF Toolkit (PDFTK) Examples

I started using PDFtk Free recently, which includes the PDFtk command-line tool PDFtk Server. Although PDFtk Free includes a user interface, it’s pretty basic unless you upgrade to PDFtk Pro (which admittedly doesn’t cost much).

As I’m on a scanning bent, I’ve got lot of PDFs to sort through and, for me, the command line is far more efficient than fiddling with a UI. The command line interface is also extremely simple to use.

Here you’ll find my boilerplate commands for accomplishing various tasks. All commands are non-destructive and create a new document rather than overwriting one of the input files.


Join a second document to the end of another PDF.

pdftk 1.pdf 2.pdf cat output out.pdf

Insert page(s) from another Document

Insert one or more pages from one PDF into a master document.

pdftk A=MasterFile.pdf B=FileToInsert.pdf cat A1-12 B1-7 A13-end output NewFile.pdf

Replace Page(s)

Replace one or more pages in a master document with specific pages from another document.

pdftk A=MasterFile.pdf B=FileToInsert.pdf cat A1-12 B1 A14-end output NewFile.pdf

Collate Scanned Odd and Even Pages (Even Pages in Reverse Order)

Interleave the pages from one document into another, where the pages in the second are reversed (for example when scanning both sides of a two-side document on a scanner that can’t flip pages automatically to scan the back of each page).

pdftk A=odd.pdf B=even.pdf shuffle A Bend-1 output collated.pdf

Extract Page(s)

Extract one or more pages from one PDF into a new document.

pdftk A=in.pdf cat A1-10 A15 A17 output out.pdf

Rotate 180 Degrees

Rotate one or more pages in a PDF 180 degrees. Use ‘east’ instead of ‘south’ to rotate 90 degrees instead.

pdftk in.pdf cat 1-endsouth output out.pdf

No comments:

Post a Comment

Spam comments will be deleted

Note: only a member of this blog may post a comment.