Cpdftk Examples

Back to Manual

Decrypt a PDF

cpdftk secured.pdf input_pw foopass output unsecured.pdf

Encrypt a PDF using 128-bit strength (the default), withhold all permissions (the default)

cpdftk 1.pdf output 1.128.pdf owner_pw foopass

Same as above, except password 'baz' must also be used to open output PDF

cpdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz

Same as above, except printing is allowed (once the PDF is open)

cpdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing

Join in1.pdf and in2.pdf into a new PDF, out1.pdf

cpdftk in1.pdf in2.pdf cat output out1.pdf

or (using handles):

cpdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf

or (using wildcards):

cpdftk *.pdf cat output combined.pdf

Remove 'page 13' from in1.pdf to create out1.pdf

cpdftk in.pdf cat 1-12 14-end output out1.pdf

or:

cpdftk A=in1.pdf cat A1-12 A14-end output out1.pdf

Apply 40-bit encryption to output, revoking all permissions (the default). Set the owner PW to 'foopass'.

cpdftk 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.

cpdftk 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)

cpdftk doc.pdf output doc.unc.pdf uncompress

Repair a PDF's corrupted XREF table and stream lengths, if possible

cpdftk broken.pdf output fixed.pdf

Burst a single PDF document into pages and dump its data to doc_data.txt

cpdftk in.pdf burst

Burst a single PDF document into encrypted pages. Allow low-quality printing

cpdftk in.pdf burst owner_pw foopass allow DegradedPrinting

Write a report on PDF document metadata and bookmarks to report.txt

cpdftk in.pdf dump_data output report.txt

Rotate the first PDF page to 90 degrees clockwise

cpdftk in.pdf cat 1E 2-end output out.pdf

Rotate an entire PDF document to 180 degrees

cpdftk in.pdf cat 1-endS output out.pdf

Licence

These examples are drawn from the PDFTK manual, which is licensed under the GPL Version 2

Send us an email...

We will endeavour to respond the same day.

Download Trial

Purchase Now

Read Manual


Bookmark and Share