Where:
<operation> may be empty, or: [ cat | attach_files | unpack_files | burst | fill_form | background | stamp | generate_fdf | dump_data | dump_data_fields | update_info ]
pdftk --help
Use it to:
* Merge PDF Documents
* Split PDF Pages into a New Document
* Rotate PDF Documents or Pages
* Decrypt Input as Necessary (Password Required)
* Encrypt Output as Desired
* Fill PDF Forms with X/FDF Data and/or Flatten Forms
* Generate FDF Data Stencil from PDF Forms
* Apply a Background Watermark or a Foreground Stamp
* Report PDF Metrics such as Metadata and Bookmarks
* Update PDF Metadata
* Attach Files to PDF Pages or the PDF Document
* Unpack PDF Attachments
* Burst a PDF Document into Single Pages
* Uncompress and Re-Compress Page Streams
* Repair Corrupted PDF (Where Possible)
<input PDF handle>=<input PDF filename>
Handles are often omitted. They are useful when specifying PDF passwords or page ranges, later.
For example: A=input1.pdf B=input2.pdf
<input PDF handle>=<input PDF file owner password>
If handles are not given, then passwords are associated with
input files by order.
Most
pdftk
features require that encrypted input PDF are accompanied
by the ~owner~ password. If the input PDF has no owner
password, then the user password must be given, instead. If the
input PDF has no passwords, then no password should be given.
When running in do_ask mode, pdftk will prompt you for a password if the supplied password is incorrect or none was given.
Available operations are: cat, attach_files, unpack_files, burst,fill_form, background, stamp, dump_data, dump_data_fields, generate_fdf, update_info. Some operations takes additional arguments, described below.
<input PDF handle>[<begin page number>[-<end page num- ber>[<qualifier>]]][<page rotation>]
Where the handle identifies one of the input PDF files, and
the beginning and ending page numbers are one-based refer-
ences to pages in the PDF file, and the qualifier can be even
or odd, and the page rotation can be N, S, E, W, L, R, or D.
If the handle is omitted from the page range, then the pages are taken from the first input PDF.
The even qualifier causes pdftk to use only the even-numbered PDF pages, so 1-6even yields pages 2, 4 and 6 in that order. 6-1even yields pages 6, 4 and 2 in that order.
The odd qualifier works similarly to the even.
The page rotation setting can cause pdftk to rotate pages and documents. Each option sets the page rotation as follows (in degrees): N: 0, E: 90, S: 180, W: 270, L: -90, R: +90, D: +180. L, R, and D make relative adjustments to a page's rota- tion.
If no arguments are passed to cat, then pdftk combines all input PDFs in the order they were given to create the output.
NOTES:
* <end page number> may be less than <begin page number>.
* The keyword end may be used to reference the final page of a document instead of a page number.
* Reference a single page by omitting the ending page number.
* The handle may be used alone to represent the entire PDF document, e.g., B1-end is the same as B.
Page Range Examples w/o Handles:
1-endE - rotate entire document 90 degrees 5 11 20 5-25oddW - take odd pages in range, rotate 90 degrees 6-1
Page Range Examples Using Handles:
Say A=in1.pdf B=in2.pdf, then:
A1-21 Bend-1odd A72 A1-21 Beven A72 AW - rotate entire document 90 degrees B A2-30evenL - take the even pages from the range, remove 90 degrees from each page's rotation A A AevenW AoddE AW BW BD
pdftk in.pdf attach_files table1.html table2.hml to_page 6 output out.pdf
pdftk report.pdf unpack_files output ~/atts/
or, interactively:
pdftk report.pdf unpack_files output PROMPT
burst
Splits a single, input PDF document into individual pages.
Also creates a report named doc_data.txt which is the same as
the output from dump_data. If the output section is omitted,
then PDF pages are named: pg_%04d.pdf, e.g.: pg_0001.pdf,
pg_0002.pdf, etc. To name these pages yourself, supply a
printf-styled format string via the output section. For
example, if you want pages named: page_01.pdf, page_02.pdf,
etc., pass output page_%02d.pdf to
pdftk.
Encryption can be
applied to the output by appending output options such as
owner_pw, e.g.:
pdftk in.pdf burst owner_pw foopass
pdftk form.pdf fill_form data.fdf output form.filled.pdf
After filling a form, the form fields remain interactive
unless you also use the flatten output option. flatten merges
the form fields with the PDF pages. You can use flatten
alone, too, but only on a single PDF:
pdftk form.pdf fill_form data.fdf output out.pdf flatten
or:
pdftk form.filled.pdf output out.pdf flatten
If the input FDF file includes Rich Text formatted data in
addition to plain text, then the Rich Text data is packed
into the form fields as well as the plain text.
pdftk
also
sets a flag that cues Acrobat/Reader to generate new field
appearances based on the Rich Text data. That way, when the
user opens the PDF, the viewer will create the Rich Text
fields on the spot. If the user's PDF viewer does not sup-
port Rich Text, then the user will see the plain text data
instead. If you flatten this form before Acrobat has a
chance to create (and save) new field appearances, then the
plain text field data is what you'll see.
pdftk in.pdf background back.pdf output out.pdf
pdftk
uses only the first page from the background PDF and
applies it to every page of the input PDF. This page is
scaled and rotated as needed to fit the input page. You can
use - to pass a background PDF into
pdftk
via stdin.
If the input PDF does not have a transparent background (such
as a PDF created from page scans) then the resulting back-
ground won't be visible -- use the stamp feature instead.
pdftk in.pdf update_info in.info output out.pdf
The permissions section may include one or more of the following features:
Printing
Top Quality Printing
DegradedPrinting
Lower Quality Printing
ModifyContents
Also allows Assembly
Assembly
CopyContents
Also allows ScreenReaders
ScreenReaders
ModifyAnnotations
Also allows FillIn
FillIn
AllFeatures
Allows the user to perform all of the above, and top
quality printing.
This option is only useful when running pdftk on a single input PDF. When assembling a PDF from multiple inputs using pdftk, any XFA data in the input is automatically omitted.
When running in dont_ask mode, pdftk will over-write files with its output without notice.
pdftk secured.pdf input_pw foopass output unsecured.pdf
pdftk 1.pdf output 1.128.pdf owner_pw foopass
pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz
pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing
pdftk in1.pdf in2.pdf cat output out1.pdf
or (using handles):
pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf
or (using wildcards):
pdftk *.pdf cat output combined.pdf
pdftk in.pdf cat 1-12 14-end output out1.pdf
or:
pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf
pdftk 1.pdf 2.pdf cat output 3.pdf encrypt_40bit owner_pw foopass
pdftk A=secured.pdf 2.pdf input_pw A=foopass cat output 3.pdf
pdftk doc.pdf output doc.unc.pdf uncompress
pdftk broken.pdf output fixed.pdf
pdftk in.pdf burst
pdftk in.pdf burst owner_pw foopass allow DegradedPrinting
pdftk in.pdf dump_data output report.txt
pdftk in.pdf cat 1E 2-end output out.pdf
pdftk in.pdf cat 1-endS output out.pdf
This is free software; see WA2LWinTools/man/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.