0% found this document useful (0 votes)
3K views3 pages

PDFTK Examples

pdftk server examples

Uploaded by

Karls
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views3 pages

PDFTK Examples

pdftk server examples

Uploaded by

Karls
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PDFtk Server Examples [Link]

com/docs/pdftk-cli-examples/

PDF Labs

PDFtk Server Examples


These examples show you how to perform common PDF tasks from the command-line using
pdftk.

Looking for a friendly Windows GUI?


Try our PDFtk Free!

Collate scanned pages


pdftk A=[Link] B=[Link] shuffle A B output [Link]
or if [Link] is in reverse order:
pdftk A=[Link] B=[Link] shuffle A Bend-1 output [Link]
Decrypt a PDF
pdftk [Link] input_pw foopass output [Link]
Encrypt a PDF using 128-bit strength (the default), withhold all permissions (the default)
pdftk [Link] output [Link] owner_pw foopass
Same as above, except password baz must also be used to open output PDF
pdftk [Link] output [Link] owner_pw foo user_pw baz
Same as above, except printing is allowed (once the PDF is open)
pdftk [Link] output [Link] owner_pw foo user_pw baz allow printing
Join [Link] and [Link] into a new PDF, [Link]
pdftk [Link] [Link] cat output [Link]
or (using handles):
pdftk A=[Link] B=[Link] cat A B output [Link]
or (using wildcards):
pdftk *.pdf cat output [Link]
Remove page 13 from [Link] to create [Link]
pdftk [Link] cat 1-12 14-end output [Link]
or:
pdftk A=[Link] cat A1-12 A14-end output [Link]

1 of 3 9/17/19, 12:56 AM
PDFtk Server Examples [Link]

When using the Windows command-prompt, it helps to use drag-and-drop from the file
manager: drag the input PDF file from the file manager onto the command-prompt, and
its full pathname will appear at the prompt.

Apply 40-bit encryption to output, revoking all permissions (the default). Set the owner PW to
foopass.
pdftk [Link] [Link] cat output [Link] encrypt_40bit owner_pw foopass
Join two files, one of which requires the password foopass. The output is not encrypted.
pdftk A=[Link] [Link] input_pw A=foopass cat output [Link]
Uncompress PDF page streams for editing the PDF in a text editor (e.g., vim, emacs)
pdftk [Link] output [Link] uncompress
Repair a PDF’s corrupted XREF table and stream lengths, if possible
pdftk [Link] output [Link]
Burst a single PDF document into pages and dump its data to doc_data.txt
pdftk [Link] burst
Burst a single PDF document into encrypted pages. Allow low-quality printing
pdftk [Link] burst owner_pw foopass allow DegradedPrinting
Write a report on PDF document metadata and bookmarks to [Link]
pdftk [Link] dump_data output [Link]
Rotate the first PDF page to 90 degrees clockwise
pdftk [Link] cat 1east 2-end output [Link]
Rotate an entire PDF document to 180 degrees
pdftk [Link] cat 1-endsouth output [Link]
Article Author: Sid Steward

Notes
Pdftk is a command-line program, so you should use your computer terminal or command
prompt when first testing these examples.

About PDF Labs


Our mission is to make PDF easier to use.
PDF Labs is operated by Sid Steward, author of PDF Hacks (O’Reilly) and the popular
PDF Toolkit.
Please contact Sid Steward by email. Include PDF Labs in the subject to ensure prompt
delivery:

2 of 3 9/17/19, 12:56 AM
PDFtk Server Examples [Link]

[Link]@[Link]

About PDF Hacks

"If you like pdftk, then you’ll appreciate the other 25 programs and scripts I created for my book,
PDF Hacks." –Sid

About PDFtk
For ten years, power users have relied on PDFtk for server-side processing of PDF documents.
Our command-line PDFtk has been — and always will be — free (as in freedom) software.
Today we also offer a convenient graphical application: PDFtk Pro. Your purchase of PDFtk Pro
will help fund the continued development of our GPL PDFtk.
Thank you for your support!

Copyright © 2004–2014 Steward and Lee, LLC

3 of 3 9/17/19, 12:56 AM

You might also like