PDFTK Examples
PDFTK Examples
com/docs/pdftk-cli-examples/
PDF Labs
1 of 3 9/17/19, 12:56 AM
PDFtk Server Examples https://www.pdflabs.com/docs/pdftk-cli-examples/
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 1.pdf 2.pdf cat output 3.pdf encrypt_40bit owner_pw foopass
Join two files, one of which requires the password foopass. The output is not encrypted.
pdftk A=secured.pdf 2.pdf input_pw A=foopass cat output 3.pdf
Uncompress PDF page streams for editing the PDF in a text editor (e.g., vim, emacs)
pdftk doc.pdf output doc.unc.pdf uncompress
Repair a PDF’s corrupted XREF table and stream lengths, if possible
pdftk broken.pdf output fixed.pdf
Burst a single PDF document into pages and dump its data to doc_data.txt
pdftk in.pdf burst
Burst a single PDF document into encrypted pages. Allow low-quality printing
pdftk in.pdf burst owner_pw foopass allow DegradedPrinting
Write a report on PDF document metadata and bookmarks to report.txt
pdftk in.pdf dump_data output report.txt
Rotate the first PDF page to 90 degrees clockwise
pdftk in.pdf cat 1east 2-end output out.pdf
Rotate an entire PDF document to 180 degrees
pdftk in.pdf cat 1-endsouth output out.pdf
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.
2 of 3 9/17/19, 12:56 AM
PDFtk Server Examples https://www.pdflabs.com/docs/pdftk-cli-examples/
"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!
3 of 3 9/17/19, 12:56 AM