Experimenting with making pretty man pages on paper.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

510 lines
23 KiB

3 years ago
  1. .\" Hey, EMACS: -*- nroff -*-
  2. .\" First parameter, NAME, should be all caps
  3. .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
  4. .\" other parameters are allowed: see man(7), man(1)
  5. .TH PDFTK 1 "May 11, 2018"
  6. .\" Please adjust this date whenever revising the manpage.
  7. .\"
  8. .\" Some roff macros, for reference:
  9. .\" .nh disable hyphenation
  10. .\" .hy enable hyphenation
  11. .\" .ad l left justify
  12. .\" .ad b justify to both left and right margins
  13. .\" .nf disable filling
  14. .\" .fi enable filling
  15. .\" .br insert line break
  16. .\" .sp <n> insert n+1 empty lines
  17. .\" for manpage-specific macros, see man(7)
  18. .ad l
  19. .SH NAME
  20. pdftk \- A handy tool for manipulating PDF
  21. .SH SYNOPSIS
  22. \fBpdftk\fR \fI<input PDF files | - | PROMPT>\fR
  23. .br
  24. [ \fBinput_pw\fR \fI<input PDF owner passwords | PROMPT>\fR ]
  25. .br
  26. [ \fI<operation>\fR \fI<operation arguments>\fR ]
  27. .br
  28. [ \fBoutput\fR \fI<output filename | - | PROMPT>\fR ]
  29. .br
  30. [ \fBencrypt_40bit\fR | \fBencrypt_128bit\fR ]
  31. .br
  32. [ \fBallow\fR \fI<permissions>\fR ]
  33. .br
  34. [ \fBowner_pw\fR \fI<owner password | PROMPT>\fR ]
  35. .br
  36. [ \fBuser_pw\fR \fI<user password | PROMPT>\fR ]
  37. .br
  38. [ \fBflatten\fR ] [ \fBneed_appearances\fR ]
  39. .br
  40. [ \fBcompress\fR | \fBuncompress\fR ]
  41. .br
  42. [ \fBkeep_first_id\fR | \fBkeep_final_id\fR ] [ \fBdrop_xfa\fR ] [ \fBdrop_xmp\fR ]
  43. .br
  44. [ \fBverbose\fR ] [ \fBdont_ask\fR | \fBdo_ask\fR ]
  45. .br
  46. Where:
  47. .br
  48. \fI<operation>\fR may be empty, or:
  49. .br
  50. [ \fBcat\fR | \fBshuffle\fR | \fBburst\fR | \fBrotate\fR |
  51. .br
  52. \fBgenerate_fdf\fR | \fBfill_form\fR |
  53. .br
  54. \fBbackground\fR | \fBmultibackground\fR |
  55. .br
  56. \fBstamp\fR | \fBmultistamp\fR |
  57. .br
  58. \fBdump_data\fR | \fBdump_data_utf8\fR |
  59. .br
  60. \fBdump_data_fields\fR | \fBdump_data_fields_utf8\fR |
  61. .br
  62. \fBdump_data_annots\fR |
  63. .br
  64. \fBupdate_info\fR | \fBupdate_info_utf8\fR |
  65. .br
  66. \fBattach_files\fR | \fBunpack_files\fR ]
  67. .br
  68. For Complete Help: \fBpdftk --help\fR
  69. .br
  70. .SH DESCRIPTION
  71. If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents. Use it to:
  72. .sp
  73. .br
  74. * Merge PDF Documents or Collate PDF Page Scans
  75. .br
  76. * Split PDF Pages into a New Document
  77. .br
  78. * Rotate PDF Documents or Pages
  79. .br
  80. * Decrypt Input as Necessary (Password Required)
  81. .br
  82. * Encrypt Output as Desired
  83. .br
  84. * Fill PDF Forms with X/FDF Data and/or Flatten Forms
  85. .br
  86. * Generate FDF Data Stencils from PDF Forms
  87. .br
  88. * Apply a Background Watermark or a Foreground Stamp
  89. .br
  90. * Report PDF Metrics, Bookmarks and Metadata
  91. .br
  92. * Add/Update PDF Bookmarks or Metadata
  93. .br
  94. * Attach Files to PDF Pages or the PDF Document
  95. .br
  96. * Unpack PDF Attachments
  97. .br
  98. * Burst a PDF Document into Single Pages
  99. .br
  100. * Uncompress and Re-Compress Page Streams
  101. .br
  102. * Repair Corrupted PDF (Where Possible)
  103. .SH OPTIONS
  104. A summary of options is included below.
  105. .TP
  106. \fB\-\-help\fR, \fB\-h\fR
  107. Show this summary of options.
  108. .TP
  109. .B <input PDF files | - | PROMPT>
  110. A list of the input PDF files. If you plan to combine these PDFs (without
  111. using handles) then list files in the order you want them combined. Use \fB-\fR
  112. to pass a single PDF into pdftk via stdin.
  113. Input files can be associated with handles, where a
  114. handle is one or more upper-case letters:
  115. \fI<input PDF handle>\fR\fB=\fR\fI<input PDF filename>\fR
  116. Handles are often omitted. They are useful when specifying PDF passwords or page ranges, later.
  117. For example: A=input1.pdf QT=input2.pdf M=input3.pdf
  118. .TP
  119. .B [input_pw <input PDF owner passwords | PROMPT>]
  120. Input PDF owner passwords, if necessary, are associated with files
  121. by using their handles:
  122. \fI<input PDF handle>\fR\fB=\fR\fI<input PDF file owner password>\fR
  123. If handles are not given, then passwords are associated with input
  124. files by order.
  125. Most pdftk features require that encrypted
  126. input PDF are accompanied by the ~owner~ password. If the input PDF
  127. has no owner password, then the user password must be given, instead.
  128. If the input PDF has no passwords, then no password should be given.
  129. When running in \fBdo_ask\fR mode, pdftk will prompt you for a password
  130. if the supplied password is incorrect or none was given.
  131. .TP
  132. .B [<operation> <operation arguments>]
  133. Available operations are: \fBcat\fR, \fBshuffle\fR, \fBburst\fR, \fBrotate\fR,
  134. \fBgenerate_fdf\fR, \fBfill_form\fR, \fBbackground\fR, \fBmultibackground\fR,
  135. \fBstamp\fR, \fBmultistamp\fR, \fBdump_data\fR, \fBdump_data_utf8\fR,
  136. \fBdump_data_fields\fR, \fBdump_data_fields_utf8\fR, \fBdump_data_annots\fR, \fBupdate_info\fR,
  137. \fBupdate_info_utf8\fR, \fBattach_files\fR, \fBunpack_files\fR. Some operations
  138. takes additional arguments, described below.
  139. If this optional argument is omitted, then pdftk runs in 'filter' mode.
  140. Filter mode takes only one PDF input and creates a new PDF after
  141. applying all of the output options, like encryption and compression.
  142. .RS 3
  143. .TP
  144. .B cat [<page ranges>]
  145. Assembles (catenates) pages from input PDFs to create a new PDF. Use \fBcat\fR to merge PDF pages or to split PDF pages from documents. You can also use it to rotate PDF pages. Page order in the new PDF is specified by the order of the given page ranges. Page ranges are described like this:
  146. \fI<input PDF handle>\fR[\fI<begin page number>\fR[\fB-\fR\fI<end page number>\fR[\fI<qualifier>\fR]]][\fI<page rotation>\fR]
  147. Where the handle identifies one of the input PDF files, and
  148. the beginning and ending page numbers are one-based references
  149. to pages in the PDF file.
  150. The qualifier can be \fBeven\fR or \fBodd\fR, and the page rotation can be \fBnorth\fR, \fBsouth\fR, \fBeast\fR, \fBwest\fR, \fBleft\fR, \fBright\fR, or \fBdown\fR.
  151. If a PDF handle is given but no pages are specified, then the entire PDF is used. If no pages are specified for any of the input PDFs, then the input PDFs' bookmarks are also merged and included in the output.
  152. If the handle is omitted from the page range, then the pages are taken from the first input PDF.
  153. The \fBeven\fR qualifier causes pdftk to use only the even-numbered PDF pages, so \fB1-6even\fR yields pages 2, 4 and 6 in that order. \fB6-1even\fR yields pages 6, 4 and 2 in that order.
  154. The \fBodd\fR qualifier works similarly to the \fBeven\fR.
  155. The page rotation setting can cause pdftk to rotate pages and documents. Each option sets the page rotation as follows (in degrees): \fBnorth\fR: 0, \fBeast\fR: 90, \fBsouth\fR: 180, \fBwest\fR: 270, \fBleft\fR: -90, \fBright\fR: +90, \fBdown\fR: +180. \fBleft\fR, \fBright\fR, and \fBdown\fR make relative adjustments to a page's rotation.
  156. If no arguments are passed to cat, then pdftk combines all input PDFs in the
  157. order they were given to create the output.
  158. .B NOTES:
  159. .br
  160. * \fI<end page number>\fR may be less than \fI<begin page number>\fR.
  161. .br
  162. * The keyword \fBend\fR may be used to reference the final page of a document instead of a page number.
  163. .br
  164. * Reference a single page by omitting the ending page number.
  165. .br
  166. * The handle may be used alone to represent the entire PDF document, e.g., B1-end is the same as B.
  167. .br
  168. * You can reference page numbers in reverse order by prefixing them with the letter \fBr\fR. For example, page r1 is the last page of the document, r2 is the next-to-last page of the document, and rend is the first page of the document. You can use this prefix in ranges, too, for example r3-r1 is the last three pages of a PDF.
  169. .B Page Range Examples without Handles:
  170. .br
  171. \fB1-endeast\fR - rotate entire document 90 degrees
  172. .br
  173. \fB5 11 20\fR - take single pages from input PDF
  174. .br
  175. \fB5-25oddwest\fR - take odd pages in range, rotate 90 degrees
  176. .br
  177. \fB6-1\fR - reverse pages in range from input PDF
  178. .B Page Range Examples Using Handles:
  179. .br
  180. Say \fBA=in1.pdf B=in2.pdf\fR, then:
  181. .br
  182. \fBA1-21\fR - take range from in1.pdf
  183. .br
  184. \fBBend-1odd\fR - take all odd pages from in2.pdf in reverse order
  185. .br
  186. \fBA72\fR - take a single page from in1.pdf
  187. .br
  188. \fBA1-21 Beven A72\fR - assemble pages from both in1.pdf and in2.pdf
  189. .br
  190. \fBAwest\fR - rotate entire in1.pdf document 90 degrees
  191. .br
  192. \fBB\fR - use all of in2.pdf
  193. .br
  194. \fBA2-30evenleft\fR - take the even pages from the range, remove 90 degrees from each page's rotation
  195. .br
  196. \fBA A\fR - catenate in1.pdf with in1.pdf
  197. .br
  198. \fBAevenwest Aoddeast\fR - apply rotations to even pages, odd pages from in1.pdf
  199. .br
  200. \fBAwest Bwest Bdown\fR - catenate rotated documents
  201. .TP
  202. .B shuffle [<page ranges>]
  203. Collates pages from input PDFs to create a new PDF. Works like the \fBcat\fR operation except that it takes one page at a time from each page range to assemble the output PDF. If one range runs out of pages, it continues with the remaining ranges. Ranges can use all of the features described above for \fBcat\fR, like reverse page ranges, multiple ranges from a single PDF, and page rotation. This feature was designed to help collate PDF pages after scanning paper documents.
  204. .TP
  205. .B burst
  206. Splits a single input PDF document into individual pages. Also creates a
  207. report named \fBdoc_data.txt\fR which is the same as the output from \fBdump_data\fR.
  208. If the \fBoutput\fR section is omitted, then PDF pages are named: pg_%04d.pdf,
  209. e.g.: pg_0001.pdf, pg_0002.pdf, etc. To name these pages yourself, supply a
  210. printf-styled format string via the \fBoutput\fR section. For example, if you want pages
  211. named: page_01.pdf, page_02.pdf, etc., pass \fBoutput page_%02d.pdf\fR to pdftk.
  212. Encryption can be applied to the output by appending output options such as \fBowner_pw\fR, e.g.:
  213. pdftk in.pdf burst owner_pw foopass
  214. .TP
  215. .B rotate [<page ranges>]
  216. Takes a single input PDF and rotates just the specified pages. All other pages remain unchanged. The page order remains unchaged. Specify the pages to rotate using the same notation as you would with \fBcat\fR, except you omit the pages that you aren't rotating:
  217. [\fI<begin page number>\fR[\fB-\fR\fI<end page number>\fR[\fI<qualifier>\fR]]][\fI<page rotation>\fR]
  218. The qualifier can be \fBeven\fR or \fBodd\fR, and the page rotation can be \fBnorth\fR, \fBsouth\fR, \fBeast\fR, \fBwest\fR, \fBleft\fR, \fBright\fR, or \fBdown\fR.
  219. Each option sets the page rotation as follows (in degrees): \fBnorth\fR: 0, \fBeast\fR: 90, \fBsouth\fR: 180, \fBwest\fR: 270, \fBleft\fR: -90, \fBright\fR: +90, \fBdown\fR: +180. \fBleft\fR, \fBright\fR, and \fBdown\fR make relative adjustments to a page's rotation.
  220. The given order of the pages doesn't change the page order in the output.
  221. .TP
  222. .B generate_fdf
  223. Reads a single input PDF file and generates an FDF file suitable for \fBfill_form\fR
  224. out of it to the given output
  225. filename or (if no output is given) to stdout. Does not create a new PDF.
  226. .TP
  227. .B fill_form <FDF data filename | XFDF data filename | - | PROMPT>
  228. Fills the single input PDF's form fields with the data from an FDF file, XFDF file or stdin. Enter the data filename
  229. after \fBfill_form\fR, or use \fB-\fR to pass the data via stdin, like so:
  230. pdftk form.pdf fill_form data.fdf output form.filled.pdf
  231. If the input FDF file includes Rich Text formatted data in addition to plain text, then the
  232. Rich Text data is packed into the form fields \fIas well as\fR the plain text. Pdftk also sets a flag
  233. that cues Reader/Acrobat to generate new field appearances based on the Rich Text data. So
  234. when the user opens the PDF, the viewer will create the Rich Text appearance on the spot. If the
  235. user's PDF viewer does not support Rich Text, then the user will see the plain text data instead.
  236. If you flatten this form before Acrobat has a chance to create (and save) new field appearances,
  237. then the plain text field data is what you'll see.
  238. Also see the \fBflatten\fR and \fBneed_appearances\fR options.
  239. .TP
  240. .B background <background PDF filename | - | PROMPT>
  241. Applies a PDF watermark to the background of a single input PDF. Pass the background PDF's
  242. filename after \fBbackground\fR like so:
  243. pdftk in.pdf background back.pdf output out.pdf
  244. Pdftk uses only the first page from the background PDF and applies it to every page of the
  245. input PDF. This page is scaled and rotated as needed to fit the input page. You can use \fB-\fR
  246. to pass a background PDF into pdftk via stdin.
  247. If the input PDF does not have a transparent background (such as a PDF created from page scans) then the resulting background won't be visible -- use the \fBstamp\fR operation instead.
  248. .TP
  249. .B multibackground <background PDF filename | - | PROMPT>
  250. Same as the \fBbackground\fR operation, but applies each page of the background PDF to the corresponding page of the input PDF. If the input PDF has more pages than the stamp PDF, then the final stamp page is repeated across these remaining pages in the input PDF.
  251. .TP
  252. .B stamp <stamp PDF filename | - | PROMPT>
  253. This behaves just like the \fBbackground\fR operation except it overlays the stamp PDF page \fIon top\fR of the input PDF document's pages. This works best if the stamp PDF page has a transparent background.
  254. .TP
  255. .B multistamp <stamp PDF filename | - | PROMPT>
  256. Same as the \fBstamp\fR operation, but applies each page of the background PDF to the corresponding page of the input PDF. If the input PDF has more pages than the stamp PDF, then the final stamp page is repeated across these remaining pages in the input PDF.
  257. .TP
  258. .B dump_data
  259. Reads a single input PDF file and reports its metadata, bookmarks (a/k/a outlines), page metrics (media, rotation and labels), data embedded by STAMPtk (see STAMPtk's \fBembed\fR option) and other data to the given output filename or (if no output is given) to stdout. Non-ASCII characters are encoded as XML numerical entities. Does not create a new PDF.
  260. .TP
  261. .B dump_data_utf8
  262. Same as \fBdump_data\fR excepct that the output is encoded as UTF-8.
  263. .TP
  264. .B dump_data_fields
  265. Reads a single input PDF file and reports form field statistics to the given output
  266. filename or (if no output is given) to stdout. Non-ASCII characters are encoded
  267. as XML numerical entities. Does not create a new PDF.
  268. .TP
  269. .B dump_data_fields_utf8
  270. Same as \fBdump_data_fields\fR excepct that the output is encoded as UTF-8.
  271. .TP
  272. .B dump_data_annots
  273. \fBThis operation currently reports only link annotations.\fR
  274. Reads a single input PDF file and reports annotation information to the given output
  275. filename or (if no output is given) to stdout. Non-ASCII characters are encoded
  276. as XML numerical entities. Does not create a new PDF.
  277. .TP
  278. .B update_info <info data filename | - | PROMPT>
  279. Changes the bookmarks and metadata in a single PDF's Info dictionary to match
  280. the input data file. The input data file uses the same syntax as the
  281. output from \fBdump_data\fR. Non-ASCII characters should be encoded as XML
  282. numerical entities.
  283. This operation does not change the metadata stored
  284. in the PDF's XMP stream, if it has one. (For this reason you should include
  285. a \fBModDate\fR entry in your updated info with a current date/timestamp, format:
  286. \fBD:YYYYMMDDHHmmSS\fR, e.g. D:201307241346 -- omitted data after YYYY revert
  287. to default values.)
  288. For example:
  289. pdftk in.pdf update_info in.info output out.pdf
  290. .TP
  291. .B update_info_utf8 <info data filename | - | PROMPT>
  292. Same as \fBupdate_info\fR except that the input is encoded as UTF-8.
  293. .TP
  294. .B attach_files <attachment filenames | PROMPT> [to_page <page number | PROMPT>]
  295. Packs arbitrary files into a PDF using PDF's file attachment features. More than
  296. one attachment may be listed after \fBattach_files\fR. Attachments are added at the
  297. document level unless the optional \fBto_page\fR option is given, in which case
  298. the files are attached to the given page number (the first page is 1, the final
  299. page is \fBend\fR). For example:
  300. pdftk in.pdf attach_files table1.html table2.html to_page 6 output out.pdf
  301. .TP
  302. .B unpack_files
  303. Copies all of the attachments from the input PDF into the current folder or to
  304. an output directory given after \fBoutput\fR. For example:
  305. pdftk report.pdf unpack_files output ~/atts/
  306. or, interactively:
  307. pdftk report.pdf unpack_files output PROMPT
  308. .RE
  309. .TP
  310. .B [output <output filename | - | PROMPT>]
  311. The output PDF filename may not be set to the name of an input filename. Use
  312. \fB-\fR to output to stdout.
  313. When using the \fBdump_data\fR operation, use \fBoutput\fR to set the name of the
  314. output data file. When using the \fBunpack_files\fR operation, use \fBoutput\fR to set
  315. the name of an output directory. When using the \fBburst\fR operation, you can use \fBoutput\fR
  316. to control the resulting PDF page filenames (described above).
  317. .TP
  318. .B [encrypt_40bit | encrypt_128bit]
  319. If an output PDF user or owner password is given, output PDF encryption
  320. strength defaults to 128 bits. This can be overridden by specifying
  321. encrypt_40bit.
  322. .TP
  323. .B [allow <permissions>]
  324. Permissions are applied to the output PDF only if an encryption strength
  325. is specified or an owner or user password is given. If permissions are
  326. not specified, they default to 'none,' which means all of the following
  327. features are disabled.
  328. The \fBpermissions\fR section may include one or more of the following
  329. features:
  330. .RS
  331. .TP
  332. .B Printing
  333. Top Quality Printing
  334. .TP
  335. .B DegradedPrinting
  336. Lower Quality Printing
  337. .TP
  338. .B ModifyContents
  339. Also allows Assembly
  340. .TP
  341. .B Assembly
  342. .TP
  343. .B CopyContents
  344. Also allows ScreenReaders
  345. .TP
  346. .B ScreenReaders
  347. .TP
  348. .B ModifyAnnotations
  349. Also allows FillIn
  350. .TP
  351. .B FillIn
  352. .TP
  353. .B AllFeatures
  354. Allows the user to perform all of the above, and top quality printing.
  355. .RE
  356. .TP
  357. .B [owner_pw <owner password | PROMPT>]
  358. .TP
  359. .B [user_pw <user password | PROMPT>]
  360. If an encryption strength is given but no passwords are supplied, then
  361. the owner and user passwords remain empty, which means that the resulting
  362. PDF may be opened and its security parameters altered by anybody.
  363. .TP
  364. .B [compress | uncompress]
  365. These are only useful when you want to edit PDF code in a text editor like vim or emacs.
  366. Remove PDF page stream compression by
  367. applying the \fBuncompress\fR filter. Use the \fBcompress\fR filter to restore compression.
  368. .TP
  369. .B [flatten]
  370. Use this option to merge an input PDF's interactive form fields (and their data) with
  371. the PDF's pages. Only one input PDF may be given. Sometimes used with the \fBfill_form\fR operation.
  372. .TP
  373. .B [need_appearances]
  374. Sets a flag that cues Reader/Acrobat to generate new field appearances based on the form field values. Use this when filling a form with non-ASCII text to ensure the best presentation in Adobe Reader or Acrobat. It won't work when combined with the \fBflatten\fR option.
  375. .TP
  376. .B [keep_first_id | keep_final_id]
  377. When combining pages from multiple PDFs, use one of these options to copy the document ID from either the first or final input document into the new output PDF. Otherwise pdftk creates a new document ID for the output PDF. When no operation is given, pdftk always uses the ID from the (single) input PDF.
  378. .TP
  379. .B [drop_xfa]
  380. If your input PDF is a form created using Acrobat 7 or Adobe Designer, then it probably has XFA data. Filling such a form using pdftk yields a PDF with data that fails to display in Acrobat 7 (and 6?). The workaround solution is to remove the form's XFA data, either before you fill the form using pdftk or at the time you fill the form. Using this option causes pdftk to omit the XFA data from the output PDF form.
  381. 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.
  382. .TP
  383. .B [drop_xmp]
  384. Many PDFs store document metadata using both an Info dictionary (old school) and an XMP stream (new school). Pdftk's \fBupdate_info\fR operation can update the Info dictionary, but not the XMP stream. The proper remedy for this is to include a \%\fBModDate\fR entry in your updated info with a current date/timestamp. The date/timestamp format is: \fBD:YYYYMMDDHHmmSS\fR, e.g. D:201307241346 -- omitted data after YYYY revert to default values. This newer ModDate should cue PDF viewers that the Info metadata is more current than the XMP data.
  385. Alternatively, you might prefer to remove the XMP stream from the PDF altogether -- that's what this option does. Note that objects inside the PDF might have their own, separate XMP metadata streams, and that \fBdrop_xmp\fR does not remove those. It only removes the PDF's document-level XMP stream.
  386. .TP
  387. .B [verbose]
  388. By default, pdftk runs quietly. Append \fBverbose\fR to the end and it
  389. will speak up.
  390. .TP
  391. .B [dont_ask | do_ask]
  392. Depending on the compile-time settings (see ASK_ABOUT_WARNINGS), pdftk might prompt you for
  393. further input when it encounters a problem, such as a bad password. Override this default behavior
  394. by adding \fBdont_ask\fR (so pdftk won't ask you what to do) or \fBdo_ask\fR (so pdftk will ask you what to do).
  395. When running in \fBdont_ask\fR mode, pdftk will over-write files with its output without notice.
  396. .SH EXAMPLES
  397. .TP 2
  398. .B Collate scanned pages
  399. pdftk A=even.pdf B=odd.pdf shuffle A B output collated.pdf
  400. .br
  401. or if odd.pdf is in reverse order:
  402. .br
  403. pdftk A=even.pdf B=odd.pdf shuffle A Bend-1 output collated.pdf
  404. .TP
  405. .B Decrypt a PDF
  406. pdftk secured.pdf input_pw foopass output unsecured.pdf
  407. .TP
  408. .B Encrypt a PDF using 128-bit strength (the default), withhold all permissions (the default)
  409. pdftk 1.pdf output 1.128.pdf owner_pw foopass
  410. .TP
  411. .B Same as above, except password 'baz' must also be used to open output PDF
  412. pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz
  413. .TP
  414. .B Same as above, except printing is allowed (once the PDF is open)
  415. pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing
  416. .TP
  417. .B Join in1.pdf and in2.pdf into a new PDF, out1.pdf
  418. pdftk in1.pdf in2.pdf cat output out1.pdf
  419. .br
  420. or (using handles):
  421. .br
  422. pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf
  423. .br
  424. or (using wildcards):
  425. .br
  426. pdftk *.pdf cat output combined.pdf
  427. .TP
  428. .B Remove page 13 from in1.pdf to create out1.pdf
  429. pdftk in.pdf cat 1-12 14-end output out1.pdf
  430. .br
  431. or:
  432. .br
  433. pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf
  434. .TP
  435. .B Apply 40-bit encryption to output, revoking all permissions (the default). Set the owner PW to 'foopass'.
  436. pdftk 1.pdf 2.pdf cat output 3.pdf encrypt_40bit owner_pw foopass
  437. .TP
  438. .B Join two files, one of which requires the password 'foopass'. The output is not encrypted.
  439. pdftk A=secured.pdf 2.pdf input_pw A=foopass cat output 3.pdf
  440. .TP
  441. .B Uncompress PDF page streams for editing the PDF in a text editor (e.g., vim, emacs)
  442. pdftk doc.pdf output doc.unc.pdf uncompress
  443. .TP
  444. .B Repair a PDF's corrupted XREF table and stream lengths, if possible
  445. pdftk broken.pdf output fixed.pdf
  446. .TP
  447. .B Burst a single PDF document into pages and dump its data to doc_data.txt
  448. pdftk in.pdf burst
  449. .TP
  450. .B Burst a single PDF document into encrypted pages. Allow low-quality printing
  451. pdftk in.pdf burst owner_pw foopass allow DegradedPrinting
  452. .TP
  453. .B Write a report on PDF document metadata and bookmarks to report.txt
  454. pdftk in.pdf dump_data output report.txt
  455. .TP
  456. .B Rotate the first PDF page to 90 degrees clockwise
  457. pdftk in.pdf cat 1east 2-end output out.pdf
  458. .TP
  459. .B Rotate an entire PDF document to 180 degrees
  460. pdftk in.pdf cat 1-endsouth output out.pdf
  461. .SH NOTES
  462. This is a port of pdftk to java. See
  463. .br
  464. https://gitlab.com/marcvinyals/pdftk
  465. .br
  466. The original program can be found at www.pdftk.com
  467. .SH AUTHOR
  468. Original author of pdftk is Sid Steward (sid.steward at pdflabs dot com).