mutool.1 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. .TH "MUTOOL" "1" "January 12, 2016"
  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 DESCRIPTION
  12. mutool is a tool based on MuPDF for dealing with document files in various manners.
  13. There are several sub commands available, as described below.
  14. .SH DRAW
  15. mutool draw [options] file [pages]
  16. .PP
  17. The draw command will render a document to image files,
  18. convert to another vector format, or extract the text content.
  19. .PP
  20. The supported input document formats are: pdf, xps, cbz, and epub.
  21. .PP
  22. The supported output image formats are: pbm, pgm, ppm, pam, png, tga, pwg, pcl and ps.
  23. The supported output vector formats are: svg, pdf, and debug trace (as xml).
  24. The supported output text formats are: plain text, html, and structured text (as xml).
  25. .TP
  26. .B \-p password
  27. Use the specified password if the file is encrypted.
  28. .TP
  29. .B \-o output
  30. The output format is inferred from the output filename.
  31. Embed %d in the name to indicate the page number (for example: "page%d.png").
  32. Printf modifiers are supported, for example "%03d".
  33. If no output is specified, the output will go to stdout.
  34. .TP
  35. .B \-F format
  36. Enforce a specific output format. Only necessary when outputting to stdout
  37. since normally the output filename is used to infer the output format.
  38. .TP
  39. .B \-R angle
  40. Rotate clockwise by given number of degrees.
  41. .TP
  42. .B \-r resolution
  43. Render the page at the specified resolution.
  44. The default resolution is 72 dpi.
  45. .TP
  46. .B \-w width
  47. Render the page at the specified width (or, if the -r flag is used,
  48. render with a maximum width).
  49. .TP
  50. .B \-h height
  51. Render the page at the specified height (or, if the -r flag is used,
  52. render with a maximum height).
  53. .TP
  54. .B \-f
  55. Fit exactly; ignore the aspect ratio when matching specified width/heights.
  56. .TP
  57. .B \-B bandheight
  58. Render in banded mode with each band no taller than the given height. This uses
  59. less memory during rendering. Only compatible with pam, pgm, ppm, pnm and png
  60. output formats. Banded rendering and md5 checksumming may not be used at the
  61. same time.
  62. .TP
  63. .B \-W width
  64. Page width in points for EPUB layout.
  65. .TP
  66. .B \-H height
  67. Page height in points for EPUB layout.
  68. .TP
  69. .B \-S size
  70. Font size in points for EPUB layout.
  71. .TP
  72. .B \-U filename
  73. User CSS stylesheet for EPUB layout.
  74. .TP
  75. .B \-c colorspace
  76. Render in the specified colorspace.
  77. Supported colorspaces are: mono, gray, grayalpha, rgb, rgbalpha, cmyk, cmykalpha.
  78. Some abbreviations are allowed: m, g, ga, rgba, cmyka.
  79. The default is chosen based on the output format.
  80. .TP
  81. .B -G gamma
  82. Apply gamma correction.
  83. Some typical values are 0.7 or 1.4 to thin or darken text rendering.
  84. .TP
  85. .B -I
  86. Invert colors.
  87. .TP
  88. .B \-s [mft5]
  89. Show various bits of information:
  90. .B m
  91. for glyph cache and total memory usage,
  92. .B f
  93. for page features such as whether the page is grayscale or color,
  94. .B t
  95. for per page rendering times as well statistics, and
  96. .B 5
  97. for md5 checksums of rendered images that can be used to check if rendering has
  98. changed.
  99. .TP
  100. .B \-A bits
  101. Specify how many bits of anti-aliasing to use. The default is 8.
  102. .TP
  103. .B \-D
  104. Disable use of display lists. May cause slowdowns, but should reduce
  105. the amount of memory used.
  106. .TP
  107. .B \-i
  108. Ignore errors.
  109. .TP
  110. .B \-L
  111. Low memory mode (avoid caching objects by clearing cache after each page).
  112. .TP
  113. .B \-P
  114. Run interpretation and rendering at the smae time.
  115. .TP
  116. .B pages
  117. Comma separated list of page numbers and ranges (for example: 1,5,10-15).
  118. If no pages are specified, then all pages will be rendered.
  119. .SH CLEAN
  120. mutool clean [options] input.pdf [output.pdf] [pages]
  121. .PP
  122. The clean command pretty prints and rewrites the syntax of a PDF file.
  123. It can be used to repair broken files, expand compressed streams, filter
  124. out a range of pages, etc.
  125. .PP
  126. If no output file is specified, it will write the cleaned PDF to "out.pdf"
  127. in the current directory.
  128. .TP
  129. .B \-p password
  130. Use the specified password if the file is encrypted.
  131. .TP
  132. .B \-g
  133. Garbage collect objects that have no references from other objects.
  134. Give the option twice to renumber all objects and compact the cross reference table.
  135. Give it three times to merge and reuse duplicate objects.
  136. .TP
  137. .B \-s
  138. Rewrite content streams.
  139. .TP
  140. .B \-d
  141. Decompress streams. This will make the output file larger, but provides
  142. easy access for reading and editing the contents with a text editor.
  143. .TP
  144. .B \-l
  145. Linearize output. Create a "Web Optimized" output file.
  146. .TP
  147. .B \-i
  148. Toggle decompression of image streams. Use in conjunction with -d to leave
  149. images compressed.
  150. .TP
  151. .B \-f
  152. Toggle decompression of font streams. Use in conjunction with -d to leave
  153. fonts compressed.
  154. .TP
  155. .B \-a
  156. ASCII Hex encode binary streams. Use in conjuction with -d and -i or -f to
  157. ensure that although the images and/or fonts are compressed, the resulting
  158. file can still be viewed and edited with a text editor.
  159. .TP
  160. .B \-z
  161. Deflate uncompressed streams.
  162. If combined with -d, any decompressed streams will be recompressed.
  163. If combined with -a, the streams will also be hex encoded after compression.
  164. .TP
  165. .B pages
  166. Comma separated list of page numbers and ranges to include.
  167. .SH EXTRACT
  168. mutool extract [options] file.pdf [object numbers]
  169. .PP
  170. The extract command can be used to extract images and font files from a PDF.
  171. If no object numbers are given on the command line, all images and fonts
  172. will be extracted.
  173. .TP
  174. .B \-p password
  175. Use the specified password if the file is encrypted.
  176. .TP
  177. .B \-r
  178. Convert images to RGB when extracting them.
  179. .SH INFO
  180. mutool info [options] file.pdf [pages]
  181. .PP
  182. The info command lists the resources used on each page in a PDF file.
  183. The default is to list all resource types, but if one
  184. or more flags are given, only the flagged types will be shown.
  185. .TP
  186. .B \-p password
  187. Use the specified password if the file is encrypted.
  188. .TP
  189. .B -F
  190. List fonts.
  191. .TP
  192. .B -I
  193. List images.
  194. .TP
  195. .B -M
  196. List page dimensions.
  197. .TP
  198. .B -S
  199. List shadings.
  200. .TP
  201. .B -P
  202. List patterns.
  203. .TP
  204. .B -X
  205. List form and postscript XObjects.
  206. .TP
  207. .B pages
  208. Comma separated list of page numbers and ranges to include.
  209. .SH CREATE
  210. mutool create [-o output.pdf] [options] page1.txt [page2.txt ...]
  211. .PP
  212. The create command creates a new PDF file with the contents created
  213. from one or more input files containing graphics commands.
  214. .TP
  215. .B \-o output
  216. If no output file is specified, it will write the created PDF to "out.pdf"
  217. in the current directory.
  218. .TP
  219. .B page.txt
  220. A page is created for each input file, with the contents of the file copied
  221. into the content stream. Special comments in the input files are parsed to
  222. define the page dimensions and font and image resources:
  223. .PP
  224. %%MediaBox 0 0 500 800
  225. .br
  226. %%Rotate 90
  227. .br
  228. %%Font Tm Times-Roman
  229. .br
  230. %%Font Fn0 path/to/font/file.ttf
  231. .br
  232. %%Image Im0 path/to/image.png
  233. .TP
  234. .B \-O
  235. Comma separated list of format specific output options:
  236. .IP
  237. .B decompress
  238. .br
  239. Decompress all object streams.
  240. .IP
  241. .B compress
  242. .br
  243. Compress all object streams.
  244. .IP
  245. .B compress-fonts
  246. .br
  247. Compress object streams for embedded fonts.
  248. .IP
  249. .B compress-images
  250. .br
  251. Compress object streams for images.
  252. .IP
  253. .B ascii
  254. .br
  255. Encode object streams using ASCII hex encoding.
  256. .IP
  257. .B pretty
  258. .br
  259. Pretty-print objects with indentation.
  260. .IP
  261. .B linearize
  262. .br
  263. Optimize document for progressive loading in viewers.
  264. .IP
  265. .B sanitize
  266. .br
  267. Clean up graphics command in content streams.
  268. .IP
  269. .B garbage[=compact|deduplicate]
  270. .br
  271. Garbage collect unused objects. With
  272. .B compact
  273. the cross-reference table will also be compacted. With
  274. .B deduplicate
  275. duplicate objects will also be recombined.
  276. .SH PAGES
  277. mutool pages [options] input.pdf [pages ...]
  278. .PP
  279. The pages command dumps information about the size and orientation
  280. of pages within the document.
  281. .TP
  282. .B \-p password
  283. Use the specified password if the file is encrypted.
  284. .TP
  285. .B pages
  286. Comma separated list of page numbers and ranges to include.
  287. .SH POSTER
  288. mutool poster [options] input.pdf [output.pdf]
  289. .PP
  290. The poster command splits each page into tiles, and puts each tile on
  291. a page of its own. It's useful for printing a large page onto smaller
  292. pieces of paper that can then be glued together to create a large poster.
  293. .TP
  294. .B \-p password
  295. Use the specified password if the file is encrypted.
  296. .TP
  297. .B \-x factor
  298. Split the page into this many horizontal pieces.
  299. .TP
  300. .B \-y factor
  301. Split the page into this many vertical pieces.
  302. .PP
  303. The output will have x times y number of pages for each input page.
  304. .SH SHOW
  305. mutool show [options] file.pdf [object numbers ...]
  306. .PP
  307. The show command will print the specified objects and streams to stdout.
  308. Streams are decoded and non-printable characters are represented
  309. with a period by default.
  310. .TP
  311. .B \-p password
  312. Use the specified password if the file is encrypted.
  313. .TP
  314. .B \-o file
  315. Write output to file instead of stdout.
  316. .TP
  317. .B \-b
  318. Print streams as binary data and omit the object header.
  319. .TP
  320. .B \-e
  321. Print streams in their original encoded (or compressed) form.
  322. .PP
  323. Specify objects by number, or use one of the following special names:
  324. .TP
  325. .B 'xref' or 'x'
  326. Print the cross reference table.
  327. .TP
  328. .B 'trailer' or 't'
  329. Print the trailer dictionary.
  330. .TP
  331. .B 'encrypt' or 'e'
  332. Print the encryption dictionary.
  333. .TP
  334. .B 'pagetree' or 'p'
  335. List the object numbers for every page.
  336. .TP
  337. .B 'grep' or 'g'
  338. Print all the objects in the file in a compact one-line format suitable for piping to grep.
  339. .TP
  340. .B 'outline' or 'o'
  341. Print the outline (table of contents).
  342. .SH RUN
  343. mutool run script.js [arguments]
  344. .PP
  345. Executes a Javascript program which has access to most of the features of the
  346. MuPDF library. The command supports ECMAScript 5 syntax in strict mode. All of
  347. the MuPDF constructors and function live in the global object, and the command
  348. line arguments are accessible from the global argv object.
  349. .PP
  350. If invoke without any arguments, it will drop you into an interactive REPL
  351. (read-eval-print-loop). On the interactive prompt, if you prefix a line with an
  352. equal character it will automatically print the results of the line.
  353. .PP
  354. See the MuPDF documentation for details about the Javascript interfaces.
  355. .SH CONVERT
  356. mutool convert [options] file [pages]
  357. .PP
  358. The convert commant is used to convert a file from one format to another.
  359. .TP
  360. .B \-p password
  361. Use the specified password if the file is encrypted.
  362. .TP
  363. .B \-A bits
  364. Specify how many bits of anti-aliasing to use. The default is 8.
  365. .TP
  366. .B \-W width
  367. Page width in points for EPUB layout.
  368. .TP
  369. .B \-H height
  370. Page height in points for EPUB layout.
  371. .TP
  372. .B \-S size
  373. Font size in points for EPUB layout.
  374. .TP
  375. .B \-U filename
  376. User CSS stylesheet for EPUB layout.
  377. .TP
  378. .B \-o output
  379. The output format is inferred from the output filename.
  380. Embed %d in the name to indicate the page number (for example: "page%d.png").
  381. Printf modifiers are supported, for example "%03d".
  382. If no output is specified, the output will go to stdout.
  383. .TP
  384. .B \-F format
  385. Enforce a specific output format. Only necessary when outputting to stdout
  386. since normally the output filename is used to infer the output format.
  387. .TP
  388. .B \-O
  389. Comma separated list of format specific output options:
  390. .SH MERGE
  391. mutool merge [options] file1 [pages] file2 [pages] ...
  392. .PP
  393. The merge command is used to pick out pages from two or more files and merge
  394. them in order into a new output file.
  395. .TP
  396. .B \-o output
  397. The output filename.
  398. .TP
  399. .B \-O
  400. See mutool create for details on this option.
  401. .SH SEE ALSO
  402. .BR mupdf (1),
  403. .SH AUTHOR
  404. MuPDF is Copyright 2006-2017 Artifex Software, Inc.