1MUTOOL(1)                   General Commands Manual                  MUTOOL(1)
2
3
4

NAME

6       mutool - all purpose tool for dealing with PDF files
7
8

SYNOPSIS

10       mutool <sub-command> [options]
11
12

DESCRIPTION

14       mutool is a tool based on MuPDF for dealing with document files in
15       various manners.  There are several sub commands available, as
16       described below.
17
18

DRAW

20       mutool draw [options] file [pages]
21
22       The draw command will render a document to image files, convert to
23       another vector format, or extract the text content.
24
25       The supported input document formats are: pdf, xps, cbz, and epub.
26
27       The supported output image formats are: pbm, pgm, ppm, pam, png, pwg,
28       pcl and ps.  The supported output vector formats are: svg, pdf, and
29       debug trace (as xml).  The supported output text formats are: plain
30       text, html, and structured text (as xml).
31
32       -p password
33              Use the specified password if the file is encrypted.
34
35       -o output
36              The output format is inferred from the output filename.  Embed
37              %d in the name to indicate the page number (for example:
38              "page%d.png").  Printf modifiers are supported, for example
39              "%03d".  If no output is specified, the output will go to
40              stdout.
41
42       -F format
43              Enforce a specific output format. Only necessary when outputting
44              to stdout since normally the output filename is used to infer
45              the output format.
46
47       -R angle
48              Rotate clockwise by given number of degrees.
49
50       -r resolution
51              Render the page at the specified resolution.  The default
52              resolution is 72 dpi.
53
54       -w width
55              Render the page at the specified width (or, if the -r flag is
56              used, render with a maximum width).
57
58       -h height
59              Render the page at the specified height (or, if the -r flag is
60              used, render with a maximum height).
61
62       -f     Fit exactly; ignore the aspect ratio when matching specified
63              width/heights.
64
65       -B bandheight
66              Render in banded mode with each band no taller than the given
67              height. This uses less memory during rendering. Only compatible
68              with pam, pgm, ppm, pnm and png output formats. Banded rendering
69              and md5 checksumming may not be used at the same time.
70
71       -W width
72              Page width in points for EPUB layout.
73
74       -H height
75              Page height in points for EPUB layout.
76
77       -S size
78              Font size in points for EPUB layout.
79
80       -U filename
81              User CSS stylesheet for EPUB layout.
82
83       -c colorspace
84              Render in the specified colorspace.  Supported colorspaces are:
85              mono, gray, grayalpha, rgb, rgbalpha, cmyk, cmykalpha.  Some
86              abbreviations are allowed: m, g, ga, rgba, cmyka.  The default
87              is chosen based on the output format.
88
89       -G gamma
90              Apply gamma correction.  Some typical values are 0.7 or 1.4 to
91              thin or darken text rendering.
92
93       -I     Invert colors.
94
95       -s [mft5]
96              Show various bits of information: m for glyph cache and total
97              memory usage, f for page features such as whether the page is
98              grayscale or color, t for per page rendering times as well
99              statistics, and 5 for md5 checksums of rendered images that can
100              be used to check if rendering has changed.
101
102       -A bits
103              Specify how many bits of anti-aliasing to use. The default is 8.
104
105       -D     Disable use of display lists. May cause slowdowns, but should
106              reduce the amount of memory used.
107
108       -i     Ignore errors.
109
110       -L     Low memory mode (avoid caching objects by clearing cache after
111              each page).
112
113       -P     Run interpretation and rendering at the same time.
114
115       pages  Comma separated list of page numbers and ranges (for example:
116              1,5,10-15,20-N), where the character N denotes the last page.
117              If no pages are specified, then all pages will be rendered.
118
119

CLEAN

121       mutool clean [options] input.pdf [output.pdf] [pages]
122
123       The clean command pretty prints and rewrites the syntax of a PDF file.
124       It can be used to repair broken files, expand compressed streams,
125       filter out a range of pages, etc.
126
127       If no output file is specified, it will write the cleaned PDF to
128       "out.pdf" in the current directory.
129
130       -p password
131              Use the specified password if the file is encrypted.
132
133       -g     Garbage collect objects that have no references from other
134              objects.  Give the option twice to also renumber all objects and
135              compact the cross reference table.  Give it three times to also
136              merge and reuse duplicate objects.  Give it four times to also
137              merge and reuse duplicate streams.
138
139       -s     Rewrite content streams.
140
141       -d     Decompress streams. This will make the output file larger, but
142              provides easy access for reading and editing the contents with a
143              text editor.
144
145       -l     Linearize output. Create a "Web Optimized" output file.
146
147       -i     Toggle decompression of image streams. Use in conjunction with
148              -d to leave images compressed.
149
150       -f     Toggle decompression of font streams. Use in conjunction with -d
151              to leave fonts compressed.
152
153       -a     ASCII Hex encode binary streams. Use in conjunction with -d and
154              -i or -f to ensure that although the images and/or fonts are
155              compressed, the resulting file can still be viewed and edited
156              with a text editor.
157
158       -z     Deflate uncompressed streams.  If combined with -d, any
159              decompressed streams will be recompressed.  If combined with -a,
160              the streams will also be hex encoded after compression.
161
162       pages  Comma separated list of page numbers and ranges (for example:
163              1,5,10-15,20-N), where the character N denotes the last page.
164              If no pages are specified, then all pages will be included.
165
166

EXTRACT

168       mutool extract [options] file.pdf [object numbers]
169
170       The extract command can be used to extract images and font files from a
171       PDF.  If no object numbers are given on the command line, all images
172       and fonts will be extracted.
173
174       -p password
175              Use the specified password if the file is encrypted.
176
177       -r     Convert images to RGB when extracting them.
178
179

INFO

181       mutool info [options] file.pdf [pages]
182
183       The info command lists the resources used on each page in a PDF file.
184       The default is to list all resource types, but if one or more flags are
185       given, only the flagged types will be shown.
186
187       -p password
188              Use the specified password if the file is encrypted.
189
190       -F     List fonts.
191
192       -I     List images.
193
194       -M     List page dimensions.
195
196       -S     List shadings.
197
198       -P     List patterns.
199
200       -X     List form and postscript XObjects.
201
202       pages  Comma separated list of page numbers and ranges (for example:
203              1,5,10-15,20-N), where the character N denotes the last page.
204              If no pages are specified, then all pages will be included.
205
206

CREATE

208       mutool create [-o output.pdf] [options] page1.txt [page2.txt ...]
209
210       The create command creates a new PDF file with the contents created
211       from one or more input files containing graphics commands.
212
213       -o output
214              If no output file is specified, it will write the created PDF to
215              "out.pdf" in the current directory.
216
217       page.txt
218              A page is created for each input file, with the contents of the
219              file copied into the content stream. Special comments in the
220              input files are parsed to define the page dimensions and font
221              and image resources:
222
223       %%MediaBox 0 0 500 800
224       %%Rotate 90
225       %%Font Tm Times-Roman
226       %%Font Fn0 path/to/font/file.ttf
227       %%Image Im0 path/to/image.png
228
229       -O     Comma separated list of format specific output options:
230
231              decompress
232              Decompress all object streams.
233
234              compress
235              Compress all object streams.
236
237              compress-fonts
238              Compress object streams for embedded fonts.
239
240              compress-images
241              Compress object streams for images.
242
243              ascii
244              Encode object streams using ASCII hex encoding.
245
246              pretty
247              Pretty-print objects with indentation.
248
249              linearize
250              Optimize document for progressive loading in viewers.
251
252              sanitize
253              Clean up graphics command in content streams.
254
255              garbage[=compact|deduplicate]
256              Garbage collect unused objects. With compact the cross-reference
257              table will also be compacted. With deduplicate duplicate objects
258              will also be recombined.
259
260

PAGES

262       mutool pages [options] input.pdf [pages ...]
263
264       The pages command dumps information about the size and orientation of
265       pages within the document.
266
267       -p password
268              Use the specified password if the file is encrypted.
269
270       pages  Comma separated list of page numbers and ranges (for example:
271              1,5,10-15,20-N), where the character N denotes the last page.
272              If no pages are specified, then all pages will be included.
273
274

POSTER

276       mutool poster [options] input.pdf [output.pdf]
277
278       The poster command splits each page into tiles, and puts each tile on a
279       page of its own. It's useful for printing a large page onto smaller
280       pieces of paper that can then be glued together to create a large
281       poster.
282
283       -p password
284              Use the specified password if the file is encrypted.
285
286       -x factor
287              Split the page into this many horizontal pieces.
288
289       -y factor
290              Split the page into this many vertical pieces.
291
292       The output will have x times y number of pages for each input page.
293
294

SHOW

296       mutool show [options] file.pdf [object numbers ...]
297
298       The show command will print the specified objects and streams to
299       stdout.  Streams are decoded and non-printable characters are
300       represented with a period by default.
301
302       -p password
303              Use the specified password if the file is encrypted.
304
305       -o file
306              Write output to file instead of stdout.
307
308       -b     Print streams as binary data and omit the object header.
309
310       -e     Print streams in their original encoded (or compressed) form.
311
312       Specify objects by number, or use one of the following special names:
313
314       'xref' Print the cross reference table.
315
316       'trailer'
317              Print the trailer dictionary.
318
319       'encrypt'
320              Print the encryption dictionary.
321
322       'pagetree'
323              List the object numbers for every page.
324
325       'grep' Print all the objects in the file in a compact one-line format
326              suitable for piping to grep.
327
328       'outline'
329              Print the outline (table of contents).
330
331

RUN

333       mutool run script.js [arguments]
334
335       Executes a Javascript program which has access to most of the features
336       of the MuPDF library. The command supports ECMAScript 5 syntax in
337       strict mode. All of the MuPDF constructors and function live in the
338       global object, and the command line arguments are accessible from the
339       global argv object.
340
341       If invoke without any arguments, it will drop you into an interactive
342       REPL (read-eval-print-loop). On the interactive prompt, if you prefix a
343       line with an equal character it will automatically print the results of
344       the line.
345
346       See the MuPDF documentation for details about the Javascript
347       interfaces.
348
349

CONVERT

351       mutool convert [options] file [pages]
352
353       The convert command is used to convert a file from one format to
354       another.
355
356       -p password
357              Use the specified password if the file is encrypted.
358
359       -A bits
360              Specify how many bits of anti-aliasing to use. The default is 8.
361
362       -W width
363              Page width in points for EPUB layout.
364
365       -H height
366              Page height in points for EPUB layout.
367
368       -S size
369              Font size in points for EPUB layout.
370
371       -U filename
372              User CSS stylesheet for EPUB layout.
373
374       -o output
375              The output format is inferred from the output filename.  Embed
376              %d in the name to indicate the page number (for example:
377              "page%d.png").  Printf modifiers are supported, for example
378              "%03d".  If no output is specified, the output will go to
379              stdout.
380
381       -F format
382              Enforce a specific output format. Only necessary when outputting
383              to stdout since normally the output filename is used to infer
384              the output format.
385
386       -O     Comma separated list of format specific output options:
387
388

MERGE

390       mutool merge [options] file1 [pages] file2 [pages] ...
391
392       The merge command is used to pick out pages from two or more files and
393       merge them in order into a new output file.
394
395       -o output
396              The output filename.
397
398       -O     See mutool create for details on this option.
399
400

SEE ALSO

402       mupdf(1),
403
404

AUTHOR

406       MuPDF is Copyright 2006-2017 Artifex Software, Inc.
407
408
409
410                               January 12, 2016                      MUTOOL(1)
Impressum