mutool.1 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215
  1. .TH "MUTOOL" "1" "April 14, 2025"
  2. .\" Please adjust this date whenever revising the manpage.
  3. .\" no hyphenation
  4. .nh
  5. .\" adjust left
  6. .ad l
  7. .SH NAME
  8. mutool \- all purpose tool for dealing with PDF files
  9. .SH SYNOPSIS
  10. mutool <sub-command> [options]
  11. .SH VERSION
  12. mutool -v
  13. .PP
  14. Shows the MuPDF version used to build mutool.
  15. .SH DESCRIPTION
  16. mutool is a tool based on MuPDF for dealing with document files in various manners.
  17. There are several sub commands available, as described below.
  18. .SH DRAW
  19. mutool draw [options] file [pages]
  20. .PP
  21. The draw command will render a document to image files,
  22. convert to another vector format, or extract the text content.
  23. .PP
  24. The supported input document formats are: pdf, xps, cbz, and epub.
  25. .PP
  26. The supported output image formats are: pbm, pgm, ppm, pam, png, pwg, pcl and ps.
  27. The supported output vector formats are: svg, pdf, and debug trace (as xml).
  28. The supported output text formats are: plain text, html, and structured text (as xml).
  29. .TP
  30. .B \-p password
  31. Use the specified password if the file is encrypted.
  32. .TP
  33. .B \-o output
  34. The output format is inferred from the output filename.
  35. Embed %d in the name to indicate the page number (for example: "page%d.png").
  36. Printf modifiers are supported, for example "%03d".
  37. If no output is specified, the output will go to stdout.
  38. .TP
  39. .B \-F format
  40. Enforce a specific output format. Only necessary when outputting to stdout
  41. since normally the output filename is used to infer the output format.
  42. .TP
  43. .B \-q
  44. Be quiet, do not print progress messages.
  45. .TP
  46. .B \-R angle
  47. Rotate clockwise by given number of degrees.
  48. .TP
  49. .B \-r resolution
  50. Render the page at the specified resolution.
  51. The default resolution is 72 dpi.
  52. .TP
  53. .B \-w width
  54. Render the page at the specified width (or, if the -r flag is used,
  55. render with a maximum width).
  56. .TP
  57. .B \-h height
  58. Render the page at the specified height (or, if the -r flag is used,
  59. render with a maximum height).
  60. .TP
  61. .B \-f
  62. Fit exactly; ignore the aspect ratio when matching specified width/heights.
  63. .TP
  64. .B \-b box
  65. Use name page box (`MediaBox`, `CropBox`, `BleedBox`, `TrimBox`, or `ArtBox`), see :ref:`defined boxes<mutool_trim_defined_boxes>`.
  66. .TP
  67. .B \-B bandheight
  68. Render in banded mode with each band no taller than the given height. This uses
  69. less memory during rendering. Only compatible with pam, pgm, ppm, pnm and png
  70. output formats. Banded rendering and md5 checksumming may not be used at the
  71. same time.
  72. .TP
  73. .B \-T threads
  74. Number of threads to use for rendering (banded mode only).
  75. .TP
  76. .B \-W width
  77. Page width in points for EPUB layout.
  78. .TP
  79. .B \-H height
  80. Page height in points for EPUB layout.
  81. .TP
  82. .B \-S size
  83. Font size in points for EPUB layout.
  84. .TP
  85. .B \-U filename
  86. User CSS stylesheet for EPUB layout.
  87. .TP
  88. .B \-X
  89. Disable document styles for EPUB layout.
  90. .TP
  91. .B \-a
  92. Disable usage of accelerator file.
  93. .TP
  94. .B \-c colorspace
  95. Render in the specified colorspace.
  96. Supported colorspaces are: \fBmono\fR, \fBgray\fR, \fBgrayalpha\fR, \fBrgb\fR, \fBrgbalpha\fR, \fBcmyk\fR, \fBcmykalpha\fR.
  97. Some abbreviations are allowed: \fBm\fR, \fBg\fR, \fBga\fR, \fBrgba\fR, \fBcmyka\fR.
  98. The default is chosen based on the output format.
  99. .TP
  100. .B \-e filename
  101. Proof ICC profile filename to use for rendering.
  102. .TP
  103. .B -G gamma
  104. Apply gamma correction.
  105. Some typical values are 0.7 or 1.4 to thin or darken text rendering.
  106. .TP
  107. .B -I
  108. Invert colors.
  109. .TP
  110. .B \-s [mft5]
  111. Show various bits of information:
  112. .B m
  113. for glyph cache and total memory usage,
  114. .B f
  115. for page features such as whether the page is grayscale or color,
  116. .B t
  117. for per page rendering times as well statistics, and
  118. .B 5
  119. for md5 checksums of rendered images that can be used to check if rendering has
  120. changed.
  121. .TP
  122. .B \-A bits
  123. Specify how many bits of anti-aliasing to use. The default is 8.
  124. .TP
  125. .B \-A bits/bits
  126. Specify how many bits of anti-aliasing to use. The default is 8. Bits for graphics is before the slash, bits for text after the slash.
  127. .TP
  128. .B \-l width
  129. Minimum stroked line width (in pixels).
  130. .TP
  131. .B \-K
  132. Do not draw text.
  133. .TP
  134. .B \-KK
  135. Only draw text.
  136. .TP
  137. .B \-D
  138. Disable use of display lists. May cause slowdowns, but should reduce
  139. the amount of memory used.
  140. .TP
  141. .B \-i
  142. Ignore errors.
  143. .TP
  144. .B \-m limit
  145. Limit memory usage in bytes.
  146. .TP
  147. .B \-L
  148. Low memory mode (avoid caching objects by clearing cache after each page).
  149. .TP
  150. .B \-P
  151. Run interpretation and rendering at the same time.
  152. .TP
  153. .B \-N
  154. Disable ICC workflow.
  155. .TP
  156. .B \-O overprint
  157. Control spot/overprint rendering: \fB0\fR for no spot rendering, \fB1\fR for Overprint simulation (default), or \fB2f\R for full spot rendering.
  158. .TP
  159. .B \-t language
  160. Specify language/script for OCR (default: eng)
  161. .TP
  162. .B \-d ocr-file-path
  163. Specify path for OCR files (default: rely on \fBTESSDATA_PREFIX\fR environment variable.
  164. .TP
  165. .B \-k correction
  166. Set the skew correction, either one of \fBauto\fR, \fB0\fR for increase size, \fB1\fR for maintain size, or \fB2\fR for decrease size.
  167. .TP
  168. .B \-k correction,angle
  169. Set the skew correction as well as the angle.
  170. .TP
  171. .B \-y l
  172. Print the layer configs to stderr.
  173. .TP
  174. .B \-y layer-number
  175. Select layer config (by number from \fB-y l\fR).
  176. .TP
  177. .B \-y layer-number,item1,item2,...
  178. Select layer config (by number from \fB-y l\fR) and toggle the listed items.
  179. .TP
  180. .B \-Y
  181. Print the individual layers to stderr.
  182. .TP
  183. .B \-z layer-number
  184. Hide individual layer.
  185. .TP
  186. .B \-Z layer-number
  187. Show individual layer.
  188. .TP
  189. .B pages
  190. Comma separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page.
  191. If no pages are specified, then all pages will be rendered.
  192. .SH CLEAN
  193. mutool clean [options] input.pdf [output.pdf] [pages]
  194. .PP
  195. The clean command pretty prints and rewrites the syntax of a PDF file.
  196. It can be used to repair broken files, expand compressed streams, filter
  197. out a range of pages, etc.
  198. .PP
  199. If no output file is specified, it will write the cleaned PDF to "out.pdf"
  200. in the current directory.
  201. .TP
  202. .B \-p password
  203. Use the specified password if the file is encrypted.
  204. .TP
  205. .B \-g
  206. Garbage collect objects that have no references from other objects.
  207. Give the option twice to also renumber all objects and compact the cross reference table.
  208. Give it three times to also merge and reuse duplicate objects.
  209. Give it four times to also merge and reuse duplicate streams.
  210. .TP
  211. .B \-s
  212. Rewrite content streams.
  213. .TP
  214. .B \-l
  215. Linearize output. No longer supported! Used to ccreate a "Web Optimized" output file.
  216. .TP
  217. .B \-D
  218. Save file without encryption.
  219. .TP
  220. .B \-E method
  221. Save file with desired encryption method, one of: \fBrc4-40\fR \fBrc4-128\fR \fBaes-128\fR, or \fBaes-256\fR.
  222. .TP
  223. .B \-O password
  224. Owner password used when encrypting output file. This is required to edit the output file.
  225. .TP
  226. .B \-U password
  227. User password used when encrypting output file. This is required to view the output file.
  228. .TP
  229. .B \-P permissions
  230. Permissions used when encrypting output file. These are the permissions that apply when the output file is viewed.
  231. .TP
  232. .B \-a
  233. ASCII Hex encode binary streams. Use in conjunction with -d and -i or -f to
  234. ensure that although the images and/or fonts are compressed, the resulting
  235. file can still be viewed and edited with a text editor.
  236. .TP
  237. .B \-d
  238. Decompress streams. This will make the output file larger, but provides
  239. easy access for reading and editing the contents with a text editor.
  240. .TP
  241. .B \-z
  242. Deflate uncompressed streams.
  243. If combined with -d, any decompressed streams will be recompressed.
  244. If combined with -a, the streams will also be hex encoded after compression.
  245. .TP
  246. .B \-e effort
  247. Configure how much effort is spent compressing the output file. 0 is default amount, otherwise a percentage of the maximum effort, 1 for minimum and 100 for maximum effort.
  248. .TP
  249. .B \-f
  250. Toggle decompression of font streams. Use in conjunction with -d to leave
  251. fonts compressed.
  252. .TP
  253. .B \-i
  254. Toggle decompression of image streams. Use in conjunction with -d to leave
  255. images compressed.
  256. .TP
  257. .B \-c
  258. Pretty-print graphics commands in content streams.
  259. .TP
  260. .B \-s
  261. Sanitize graphics commands in content streams, this means, for example, removing invalid or redundant commands.
  262. .TP
  263. .B \-t
  264. Use compact PDF object syntax. This saves space.
  265. .TP
  266. .B \-tt
  267. Use indented PDF object syntax. This is more human-readable.
  268. .TP
  269. .B \-L
  270. Print comments containing labels showing how each object can be reached from the Root.
  271. .TP
  272. .B \-A
  273. Create appearance streams for annotations that are missing appearance streams.
  274. .TP
  275. .B \-AA
  276. Recreate appearance streams for all annotations.
  277. .TP
  278. .B \-m
  279. Preserve metadata.
  280. .TP
  281. .B \-S
  282. Subset fonts if possible. (EXPERIMENTAL!)
  283. .TP
  284. .B \-Z
  285. Use object streams cross reference streams for extra compressoin.
  286. .TP
  287. .B \-\-\fR(\fBcolor\fR,\fBgray\fR,\fBbitonal\fR)\fB-\fR(,\fBlossy-\fR,\fBlossless-\fR)\fBimage-subsample-method method
  288. Set the subsampling method (\fBaverage\fR, or \fBbicubic\fR) for the
  289. desired image types, for example color-lossy and bitonal-loessless.
  290. .TP
  291. .B \-\-\fR(\fBcolor\fR,\fBgray\fR,\fBbitonal\fR)\fB-\fR(,\fBlossy-\fR,\fBlossless-\fR)\fBimage-subsample-dpi dpi
  292. Set the resolution at which to subsample.
  293. .TP
  294. .B \-\-\fR(\fBcolor\fR,\fBgray\fR,\fBbitonal\fR)\fB-\fR(,\fBlossy-\fR,\fBlossless-\fR)\fBimage-recompress-method quality
  295. Set the recompression quality to either of \fBnever\fR, \fBsame\fR, \fBlossless\fR, \fBjpeg\fR, \fBj2k\fR, \fBfax\fR, or \fBjbig2\fR.
  296. .TP
  297. .B \-\-structure=\fR(\fBkeep\fR|\fBdrop\fR)
  298. Keep or drop the structure tree.
  299. .TP
  300. .B pages
  301. Comma separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page.
  302. If no pages are specified, then all pages will be included.
  303. .SH EXTRACT
  304. mutool extract [options] file.pdf [object numbers]
  305. .PP
  306. The extract command can be used to extract images and font files from a PDF.
  307. If no object numbers are given on the command line, all images and fonts
  308. will be extracted.
  309. .TP
  310. .B \-p password
  311. Use the specified password if the file is encrypted.
  312. .TP
  313. .B \-r
  314. Convert images to RGB when extracting them.
  315. .TP
  316. .B \-a
  317. Embed SMasks as alpha channel..
  318. .TP
  319. .B \-N
  320. Do not use ICC color conversions.
  321. .SH INFO
  322. mutool info [options] file.pdf [pages]
  323. .PP
  324. The info command lists the resources used on each page in a PDF file.
  325. The default is to list all resource types, but if one
  326. or more flags are given, only the flagged types will be shown.
  327. .TP
  328. .B \-p password
  329. Use the specified password if the file is encrypted.
  330. .TP
  331. .B -F
  332. List fonts.
  333. .TP
  334. .B -I
  335. List images.
  336. .TP
  337. .B -M
  338. List page dimensions.
  339. .TP
  340. .B -S
  341. List shadings.
  342. .TP
  343. .B -P
  344. List patterns.
  345. .TP
  346. .B -X
  347. List form and postscript XObjects.
  348. .TP
  349. .B -Z
  350. List ZUGFeRD info.
  351. .TP
  352. .B pages
  353. Comma separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page.
  354. If no pages are specified, then all pages will be included.
  355. .SH CREATE
  356. mutool create [-o output.pdf] [options] page1.txt [page2.txt ...]
  357. .PP
  358. The create command creates a new PDF file with the contents created
  359. from one or more input files containing graphics commands.
  360. .TP
  361. .B \-o output
  362. If no output file is specified, it will write the created PDF to "out.pdf"
  363. in the current directory.
  364. .TP
  365. .B page.txt
  366. A page is created for each input file, with the contents of the file copied
  367. into the content stream. Special comments in the input files are parsed to
  368. define the page dimensions and font and image resources:
  369. .PP
  370. %%MediaBox 0 0 500 800
  371. .br
  372. %%Rotate 90
  373. .br
  374. %%Font Tm Times-Roman
  375. .br
  376. %%Font Fn0 path/to/font/file.ttf
  377. .br
  378. %%Image Im0 path/to/image.png
  379. .TP
  380. .B \-O options
  381. Comma separated list of format specific output options, see \fIOUTPUT OPTIONS\fR below.
  382. .SH PAGES
  383. mutool pages [options] input.pdf [pages ...]
  384. .PP
  385. The pages command dumps information about the size and orientation
  386. of pages within the document.
  387. .TP
  388. .B \-p password
  389. Use the specified password if the file is encrypted.
  390. .TP
  391. .B pages
  392. Comma separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page.
  393. If no pages are specified, then all pages will be included.
  394. .SH POSTER
  395. mutool poster [options] input.pdf [output.pdf]
  396. .PP
  397. The poster command splits each page into tiles, and puts each tile on
  398. a page of its own. It's useful for printing a large page onto smaller
  399. pieces of paper that can then be glued together to create a large poster.
  400. .TP
  401. .B \-p password
  402. Use the specified password if the file is encrypted.
  403. .TP
  404. .B \-m margin
  405. Margin (overlap) between pages in points or percent.
  406. .TP
  407. .B \-x factor
  408. Split the page into this many horizontal pieces.
  409. .TP
  410. .B \-y factor
  411. Split the page into this many vertical pieces.
  412. .TP
  413. .B \-r
  414. Splits hoirzontally from right to left (default splits from left to right).
  415. .PP
  416. The output will have x times y number of pages for each input page.
  417. .SH SHOW
  418. mutool show [options] file.pdf [object numbers ...]
  419. .PP
  420. The show command will print the specified objects and streams to stdout.
  421. Streams are decoded and non-printable characters are represented
  422. with a period by default.
  423. .TP
  424. .B \-p password
  425. Use the specified password if the file is encrypted.
  426. .TP
  427. .B \-o file
  428. Write output to file instead of stdout.
  429. .TP
  430. .B \-b
  431. Print streams as binary data and omit the object header.
  432. .TP
  433. .B \-e
  434. Print streams in their original encoded (or compressed) form.
  435. .TP
  436. .B \-g
  437. Print each object on a single line, suitable for grep.
  438. .TP
  439. .B \-r
  440. Force repair before showing any objects.
  441. .PP
  442. Specify objects by number, or use one of the following special names:
  443. .TP
  444. .B 'xref'
  445. Print the cross reference table.
  446. .TP
  447. .B 'trailer'
  448. Print the trailer dictionary.
  449. .TP
  450. .B 'encrypt'
  451. Print the encryption dictionary.
  452. .TP
  453. .B 'pagetree'
  454. List the object numbers for every page.
  455. .TP
  456. .B 'grep'
  457. Print all the objects in the file in a compact one-line format suitable for piping to grep.
  458. .TP
  459. .B 'outline'
  460. Print the outline (table of contents).
  461. .SH RUN
  462. mutool run script.js [arguments]
  463. .PP
  464. Executes a Javascript program which has access to most of the features of the
  465. MuPDF library. The command supports ECMAScript 5 syntax in strict mode. All of
  466. the MuPDF constructors and function live in the global object, and the command
  467. line arguments are accessible from the global argv object.
  468. .PP
  469. If invoke without any arguments, it will drop you into an interactive REPL
  470. (read-eval-print-loop). On the interactive prompt, if you prefix a line with an
  471. equal character it will automatically print the results of the line.
  472. .PP
  473. See the MuPDF documentation for details about the Javascript interfaces.
  474. .SH CONVERT
  475. mutool convert [options] file [pages]
  476. .PP
  477. The convert command is used to convert a file from one format to another.
  478. .TP
  479. .B \-p password
  480. Use the specified password if the file is encrypted.
  481. .TP
  482. .B \-b box
  483. Use name page box (`MediaBox`, `CropBox`, `BleedBox`, `TrimBox`, or `ArtBox`), see :ref:`defined boxes<mutool_trim_defined_boxes>`.
  484. .TP
  485. .B \-A bits
  486. Specify how many bits of anti-aliasing to use. The default is 8.
  487. .TP
  488. .B \-W width
  489. Page width in points for EPUB layout.
  490. .TP
  491. .B \-H height
  492. Page height in points for EPUB layout.
  493. .TP
  494. .B \-S size
  495. Font size in points for EPUB layout.
  496. .TP
  497. .B \-U filename
  498. User CSS stylesheet for EPUB layout.
  499. .TP
  500. .B \-o output
  501. The output format is inferred from the output filename.
  502. Embed %d in the name to indicate the page number (for example: "page%d.png").
  503. Printf modifiers are supported, for example "%03d".
  504. If no output is specified, the output will go to stdout.
  505. .TP
  506. .B \-F format
  507. Enforce a specific output format. Only necessary when outputting to stdout
  508. since normally the output filename is used to infer the output format.
  509. .TP
  510. .B \-O options
  511. Comma separated list of format specific output options, see \fIOUTPUT OPTIONS\fR below.
  512. .SH MERGE
  513. mutool merge [options] file1 [pages] file2 [pages] ...
  514. .PP
  515. The merge command is used to pick out pages from two or more files and merge
  516. them in order into a new PDF output file.
  517. .TP
  518. .B \-o output
  519. The output filename.
  520. .TP
  521. .B \-O options
  522. Comma separated list of format specific output options, see \fIOUTPUT OPTIONS\fR below.
  523. .SH BAKE
  524. mutool bake [options] input.pdf [output.pdf]
  525. .PP
  526. Normally annotations and form field widgets are separate content streams
  527. that get drawn on top of the page contents. This command bakes annotations
  528. and/or widgets into the page contents, making them inseparable.
  529. After baking in annotations and widgets they are just visual representaitons
  530. of what the original annotation/widget looked like, their properties can no
  531. longer be edited since they no longer exist as proper annotation/widgets.
  532. .TP
  533. .B \-A
  534. Do not bake in annotations.
  535. .TP
  536. .B \-F
  537. Do not bake in form field widgets.
  538. .TP
  539. .B \-O options
  540. A comma separated list of PDF options. See \fIOUTPUT OPTIONS\fR below.
  541. .SH RECOLOR
  542. mutool recolor [options] input.pdf
  543. .PP
  544. Change the color space used in a PDF to a desired one. This command can,
  545. for example, change a color PDF to be grayscale.
  546. .TP
  547. .B \-c colorspace
  548. Desired output colorspace, choose one of \fBgray\fR (default), \fBrgb\fR, or \fBcmyk\fR.
  549. .TP
  550. .B \-r
  551. Remove any output intents.
  552. .TP
  553. .B \-o filename
  554. The output filename.
  555. .SH TRACE
  556. mutool trace [options] file1 [pages] file2 [pages] ...
  557. .PP
  558. Prints a trace of device calls needed to render the desired pages from the given document.
  559. .TP
  560. .B \-p password
  561. Use the specified password if the file is encrypted.
  562. .TP
  563. .B \-W width
  564. Page width in points for EPUB layout.
  565. .TP
  566. .B \-H height
  567. Page height in points for EPUB layout.
  568. .TP
  569. .B \-S size
  570. Font size in points for EPUB layout.
  571. .TP
  572. .B \-U filename
  573. User CSS stylesheet for EPUB layout.
  574. .TP
  575. .B \-X
  576. Disable document styles for EPUB layout.
  577. .TP
  578. .B \-d
  579. Enable use of display lists.
  580. .B pages
  581. Comma separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page.
  582. If no pages are specified, then all pages will be rendered.
  583. .SH TRIM
  584. mutool trim [options] input.pdf
  585. .PP
  586. Makes a modified version of a PDF with content that falls inside (or outside) of the given box removed.
  587. .TP
  588. .B \-b box
  589. Which box to trim to, either one of: \fBMediaBox\fR (default) \fBCropBox\fR \fBBleedBox\fR \fBTrimBox\fR, or \fBArtBox\fR.
  590. .TP
  591. .B \-f
  592. Fallback to mediabox if specified box not available.
  593. .TP
  594. .B \-m all
  595. Add same margins to all sides of the box, where \fBall\fR is positive for inwards, negative for outwards.
  596. .TP
  597. .B \-m vertical,horizontal
  598. Add specific margins for vertical and horizontal sides of the box, where \fBvertical\fR and \fBhorizonal\fR are positive for inwards, negative for outwards.
  599. .TP
  600. .B \-m top,right,bottom,left
  601. Add specific margins for top, right, bottom and left sides of the box, where \fBtop\fR, \fBright\fR, \fBbottom\fR, and \fBleft\fR each are positive for inwards, negative for outwards.
  602. .TP
  603. .B \-e
  604. Exclude contents of box rather than include them.
  605. .TP
  606. .B \-o filename
  607. The output filename.
  608. .SH SIGN
  609. mutool sign [options] input.pdf [signature object number]
  610. .PP
  611. Reads a PDF file and prints infromation about each signature field object. With
  612. suitable options all or specified signatures can be verified, cleared or signed.
  613. .TP
  614. .B \-p password
  615. Use the specified password if the file is encrypted.
  616. .TP
  617. .B \-v
  618. Verify all signatures, or only the specified signature.
  619. .TP
  620. .B \-c
  621. Clear all signatures, or only the specified signature.
  622. .TP
  623. .B \-s certificate-filename
  624. Read a certificate from the given filename and use it to sign all, or just the specified signature.
  625. .TP
  626. .B \-P certificate-password
  627. Use the specified password when opening the certificate.
  628. .TP
  629. .B \-o filename
  630. The output filename.
  631. .B signature object numbers
  632. A list of PDF object number for signatures to verify/clear/sign. If no such object numbers are given, all signatures will be
  633. processed.
  634. .SH AUDIT
  635. mutool audit [options] file1.pdf file2.pdf ...
  636. .PP
  637. Outputs a report of operator and space usage for each given PDF file.
  638. .TP
  639. .B -o filename
  640. The output filename for the report.
  641. .SH OUTPUT OPTIONS
  642. Configuring output is done by a comma separated list of output options.
  643. .TP
  644. .B Raster format options
  645. These apply to output formats: cbz, png, pnm, pgm, ppm, pam, pbm, pkm.
  646. .IP
  647. .B rotate=N
  648. .in +4n
  649. Rotate rendered pagess N degrees counterclockwise.
  650. .in
  651. .IP
  652. .B resoution=N
  653. .in +4n
  654. Set both X and Y resolution in pixels per inch.
  655. .in
  656. .IP
  657. .B x-resolution=N
  658. .in +4n
  659. Set X resolution of rendred pages in pixels per inch.
  660. .in
  661. .IP
  662. .B y-resolution=N
  663. .in +4n
  664. Set Y resolution of rendred pages in pixels per inch.
  665. .in
  666. .IP
  667. .B width=N
  668. .in +4n
  669. Render pages to fit N pixels wide (ignore resolution option).
  670. .in
  671. .IP
  672. .B height=N
  673. .in +4n
  674. Render pages to fit N pixels tall (ignore resolution option).
  675. .in
  676. .IP
  677. .B colorspace=\fR(\fBgray\fR|\fBrgb\fR|\fBcmyk\fR)
  678. .in +4n
  679. Render pages using the specified colorspace.
  680. .in
  681. .IP
  682. .B alpha
  683. Render pages with alpha channel and transparent background.
  684. .in
  685. .IP
  686. .B graphics=\fR(\fBaaN\fR|\fBcop\fR|\fBapp\fR)
  687. .br
  688. .B text=\fR(\fBaaN\fR|\fBcop\fR|\fBapp\fR)
  689. .in +4n
  690. Set the rasterizer to use for graphics or text respectively:
  691. .in +4n
  692. .B aaN
  693. .in +4n
  694. Antialias with N bits (0 to 8).
  695. .in
  696. .B cop
  697. .in +4n
  698. Center of pixel.
  699. .in
  700. .B app
  701. .in +4n
  702. Any part of pixel.
  703. .in -12n
  704. .TP
  705. .B PDF options
  706. .IP
  707. .B decompress
  708. .in +4n
  709. Decompress all streams (except compress-fonts/images).
  710. .in
  711. .IP
  712. .B compress=\fR(\fByes\fR|\fBflate\fR|\fBbrotli\fR)
  713. .in +4n
  714. Compress all streams, if no value is given, or the value is \fByesf\R the default is to use flate.
  715. .in
  716. .IP
  717. .B compress-fonts
  718. .in +4n
  719. Compress object stream for embedded fonts.
  720. .in
  721. .IP
  722. .B compress-images
  723. .in +4n
  724. Compress object streams for images.
  725. .in
  726. .IP
  727. .B compress-effort=\fR(\fB0\fR|\fBPERCENTAGE\fR)
  728. .in +4n
  729. Effort spent compressing, 0 is default, otherwise percentage of max effort.
  730. .in
  731. .IP
  732. .B ascii
  733. .in +4n
  734. Encode object streams using ASCII hex encoding.
  735. .in
  736. .IP
  737. .B pretty
  738. .in +4n
  739. Pretty-print objects with indentation.
  740. .in
  741. .IP
  742. .B labels
  743. .in +4n
  744. Print object labels.
  745. .in
  746. .IP
  747. .B linearize
  748. .in +4n
  749. Optimize document for progressive loading in viewers ( no longer supported!).
  750. .in
  751. .IP
  752. .B clean
  753. .in +4n
  754. Pretty-print graphics commands in content streams.
  755. .in
  756. .IP
  757. .B sanitize
  758. .in +4n
  759. Clean up graphics command in content streams.
  760. .in
  761. .IP
  762. .B garbage
  763. .in +4n
  764. Garbage collect unused objects.
  765. .in
  766. .IP
  767. .B garbage=compact
  768. .in +4n
  769. Garbage collect unused object, and compact cross reference table.
  770. .in
  771. .IP
  772. .B garbage=deduplicate
  773. .in +4n
  774. Garbage collect unused objects, compact cross reference table, and recombine duplicate objects.
  775. .in
  776. .IP
  777. .B incremental
  778. .in +4n
  779. Write changes as incremental update.
  780. .in
  781. .IP
  782. .B objstms
  783. .in +4n
  784. Use object streams and cross reference streams.
  785. .in
  786. .IP
  787. .B appearance=\fR(\fByes\fR|\fBall\fR)
  788. .in +4n
  789. Synthesize just missing, or all, annotation/widget apperance streams.
  790. .in
  791. .IP
  792. .B continue-on-error
  793. .in +4n
  794. Continue saving the document even if there is an error.
  795. .in
  796. .IP
  797. .B decrypt
  798. .in +4n
  799. Write unencrypted document.
  800. .in
  801. .IP
  802. .B encrypt=\fR(\fBnone\fR|\fBkeep\fR|\fBrc4-40\fR|\fBrc4-128\fR|\fBaes-128\fR|\fBaes-256\fR)
  803. .in +4n
  804. Write encrypted document using specified encryption method.
  805. .in
  806. .IP
  807. .B permissions=NUMBER
  808. .in +4n
  809. Document permissions to grant when encrypting.
  810. .in
  811. .IP
  812. .B user-password=PASSWORD
  813. .in +4n
  814. Password required to read document.
  815. .in
  816. .IP
  817. .B owner-password=PASSWORD
  818. .in +4n
  819. Password required to edit document.
  820. .in
  821. .IP
  822. .B regenerate-id=no
  823. .in +4n
  824. Regenerate document id (default yes).
  825. .in
  826. .TP
  827. .B Text format options
  828. These apply to formats: html, xhtml, text stext.
  829. .IP
  830. .B preserve-images
  831. .in +4n
  832. Keep imagess in output.
  833. .in
  834. .IP
  835. .B preserve-ligatures
  836. .in +4n
  837. Do not expand ligature into constituent characters.
  838. .in
  839. .IP
  840. .B preserve-spans
  841. .in +4n
  842. Do not merge spans on the same line.
  843. .in
  844. .IP
  845. .B preserve-whitespace
  846. .in +4n
  847. Do not convert all whitespace into space characters.
  848. .in
  849. .IP
  850. .B inhibit-spaces
  851. .in +4n
  852. Do not add spaces between gaps in the text.
  853. .in
  854. .IP
  855. .B paragraph-break
  856. .in +4n
  857. Break blocks at paragraph boundaries.
  858. .in
  859. .IP
  860. .B dehyphenate
  861. .in +4n
  862. Attempts to join up hyphenated words.
  863. .in
  864. .IP
  865. .B ignore-actualtext
  866. .in +4n
  867. Do not apply ActualText replacements.
  868. .in
  869. .IP
  870. .B use-cid-for-unknown-unicode
  871. .in +4n
  872. Use character code if unicode mapping fails.
  873. .in
  874. .IP
  875. .B use-gid-for-unknown-unicode
  876. .in +4n
  877. Use glyph index if unicode mapping fails.
  878. .in
  879. .IP
  880. .B accurate-bboxes
  881. .in +4n
  882. Calculate bboxes from the outlines.
  883. .in
  884. .IP
  885. .B accurate-ascenders
  886. .in +4n
  887. Calculate ascender/descender from font glyphs.
  888. .in
  889. .IP
  890. .B accurate-side-bearings
  891. .in +4n
  892. Expand character bboxes to completely include width of glyphs.
  893. .in
  894. .IP
  895. .B collect-styles
  896. .in +4n
  897. Attempt to detect text features (fake bold, strikeout, underlined, etc.)
  898. .in
  899. .IP
  900. .B clip
  901. .in +4n
  902. Do not include text that is completely clipped.
  903. .in
  904. .IP
  905. .B clip-rect=x0:y0:x1:y1
  906. .in +4n
  907. Specify clipping rectangle within which to collect content.
  908. .in
  909. .IP
  910. .B structured
  911. .in +4n
  912. Collect structure markup.
  913. .in
  914. .IP
  915. .B vectors
  916. .in +4n
  917. Include vector bboxes in output.
  918. .in
  919. .IP
  920. .B segment
  921. .in +4n
  922. Attempt to segment the page.
  923. .in
  924. .IP
  925. .B table-hunt
  926. .in +4n
  927. Hunt for tables within a (segmented) page.
  928. .in
  929. .TP
  930. .B PCL options
  931. .IP
  932. .B colorspace=\fR(\fBmono\fR|\fBrgb\fR)
  933. .in +4n
  934. Render 1-bit black and white or a full color page.
  935. .in
  936. .IP
  937. .B preset=\fR(\fBgeneric\fR|\fBljet4\fR|\fBdj500\fR|\fBfs600\fR|\fBlj\fR|\fBlj2\fR|\fBlj3\fR|\fBlj4\fR|\fBlj4pl\fR|\fBlj4d\fR|\fBlp2563b\fR|\fBoce9050\fR)
  938. .in +4n
  939. Render 1-bit black and white or a full color page.
  940. .in
  941. .IP
  942. .B spacing=\fR(\fB0\fR|\fB1\fR|\fB2\fR|\fB3\fR)
  943. .in +4n
  944. Set vertical spacing to none, PCL 3 (<ESC>*p+<n>Y), PCL 5 (<ESC>*b<n>Y), or PCL 6 (<ESC>*b<n>Y and clear seed row).
  945. .in
  946. .IP
  947. .B mode2
  948. .in +4n
  949. Enable mode 2 graphics compression.
  950. .in
  951. .IP
  952. .B mode3
  953. .in +4n
  954. Enable mode 3 graphics compression.
  955. .in
  956. .IP
  957. .B eog_reset
  958. .in +4n
  959. End of graphics (<ESC>+rB) resets all parameters.
  960. .in
  961. .IP
  962. .B has_duplex
  963. .in +4n
  964. Duplex supported (<ESC>&l<duplex>S).
  965. .in
  966. .IP
  967. .B has_papersize
  968. .in +4n
  969. Papersize setting supported (<ESC>&l<sizecode>A).
  970. .in
  971. .IP
  972. .B has_copies
  973. .in +4n
  974. Number of copies supported (<ESC>&l<copies>X).
  975. .in
  976. .IP
  977. .B is_ljet4pjl
  978. .in +4n
  979. Disable/enable HP 4PJL model-specific output.
  980. .in
  981. .IP
  982. .B is_oce9050
  983. .in +4n
  984. Disable/enable Oce 9050 models-specific output.
  985. .in
  986. .TP
  987. .B PCLm options
  988. .IP
  989. .B compression=\fR(\fBnone\fR|\fBflate\fR)
  990. .in +4n
  991. No compression (default), or enable flate compression.
  992. .in
  993. .IP
  994. .B strip-height=N
  995. .in +4n
  996. Strip height (default 16).
  997. .in
  998. .TP
  999. .B PWG options
  1000. .IP
  1001. .B media_class=<string>
  1002. .in +4n
  1003. Set the media_class field.
  1004. .in
  1005. .IP
  1006. .B media_color=<string>
  1007. .in +4n
  1008. Set the media_color field.
  1009. .in
  1010. .IP
  1011. .B media_type=<string>
  1012. .in +4n
  1013. Set the media_type field.
  1014. .in
  1015. .IP
  1016. .B output_type=<string>
  1017. .in +4n
  1018. Set the output_type field.
  1019. .in
  1020. .IP
  1021. .B rendering_intent=<string>
  1022. .in +4n
  1023. Set the rendering_intent field.
  1024. .in
  1025. .IP
  1026. .B page_size_name=<string>
  1027. .in +4n
  1028. Set the page_size_name field.
  1029. .in
  1030. .IP
  1031. .B advance_distance=<int>
  1032. .in +4n
  1033. Set the advance_distance field.
  1034. .in
  1035. .IP
  1036. .B advance_media=<int>
  1037. .in +4n
  1038. Set the advance_media field.
  1039. .in
  1040. .IP
  1041. .B collate=<int>
  1042. .in +4n
  1043. Set the collate field.
  1044. .in
  1045. .IP
  1046. .B cut_media=<int>
  1047. .in +4n
  1048. Set the cut_media field.
  1049. .in
  1050. .IP
  1051. .B duplex=<int>
  1052. .in +4n
  1053. Set the duplex field.
  1054. .in
  1055. .IP
  1056. .B insert_sheet=<int>
  1057. .in +4n
  1058. Set the insert_sheet field.
  1059. .in
  1060. .IP
  1061. .B jog=<int>
  1062. .in +4n
  1063. Set the jog field.
  1064. .in
  1065. .IP
  1066. .B leading_edge=<int>
  1067. .in +4n
  1068. Set the leading_edge field.
  1069. .in
  1070. .IP
  1071. .B manual_feed=<int>
  1072. .in +4n
  1073. Set the manual_feed field.
  1074. .in
  1075. .IP
  1076. .B media_position=<int>
  1077. .in +4n
  1078. Set the media_position field.
  1079. .in
  1080. .IP
  1081. .B media_weight=<int>
  1082. .in +4n
  1083. Set the media_weight field.
  1084. .in
  1085. .IP
  1086. .B mirror_print=<int>
  1087. .in +4n
  1088. Set the mirror_print field.
  1089. .in
  1090. .IP
  1091. .B negative_print=<int>
  1092. .in +4n
  1093. Set the negative_print field.
  1094. .in
  1095. .IP
  1096. .B num_copies=<int>
  1097. .in +4n
  1098. Set the num_copies field.
  1099. .in
  1100. .IP
  1101. .B orientation=<int>
  1102. .in +4n
  1103. Set the orientation field.
  1104. .in
  1105. .IP
  1106. .B output_face_up=<int>
  1107. .in +4n
  1108. Set the output_face_up field.
  1109. .in
  1110. .IP
  1111. .B page_size_x=<int>
  1112. .in +4n
  1113. Set the page_size_x field.
  1114. .in
  1115. .IP
  1116. .B page_size_y=<int>
  1117. .in +4n
  1118. Set the page_size_y field.
  1119. .in
  1120. .IP
  1121. .B separations=<int>
  1122. .in +4n
  1123. Set the separations field.
  1124. .in
  1125. .IP
  1126. .B tray_switch=<int>
  1127. .in +4n
  1128. Set the tray_switch field.
  1129. .in
  1130. .IP
  1131. .B tumble=<int>
  1132. .in +4n
  1133. Set the tumble field.
  1134. .in
  1135. .IP
  1136. .B media_type_num=<int>
  1137. .in +4n
  1138. Set the media_type_num field.
  1139. .in
  1140. .IP
  1141. .B compression=<int>
  1142. .in +4n
  1143. Set the compression field.
  1144. .in
  1145. .IP
  1146. .B row_count=<int>
  1147. .in +4n
  1148. Set the row_count field.
  1149. .in
  1150. .IP
  1151. .B row_feed=<int>
  1152. .in +4n
  1153. Set the row_feed field.
  1154. .in
  1155. .IP
  1156. .B row_step=<int>
  1157. .in +4n
  1158. Set the row_step field.
  1159. .in
  1160. .TP
  1161. .B SVG options
  1162. .IP
  1163. .B text=text
  1164. .in +4n
  1165. Emit text as <text> elements (inaccurate fonts).
  1166. .in
  1167. .IP
  1168. .B text=path
  1169. .in +4n
  1170. Emit text as <path> elements (accurate fonts).
  1171. .in
  1172. .IP
  1173. .B no-reuse-images
  1174. .in +4n
  1175. Do not reuse image using <symbol> definitions.
  1176. .in -4n
  1177. .SH EXIT STATUS
  1178. The exit status is 0 upon successful execution and non-zero upon error.
  1179. .SH SEE ALSO
  1180. .BR mupdf (1),
  1181. .SH AUTHOR
  1182. MuPDF is Copyright 2004-2025 Artifex Software, Inc.