summaryrefslogtreecommitdiff
path: root/docs/man/mutool.1
blob: d84c14c65be30a44e3c1501c3b47894017279385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
.TH "MUTOOL" "1" "January 12, 2016"
.\" Please adjust this date whenever revising the manpage.
.\" no hyphenation
.nh
.\" adjust left
.ad l

.SH NAME
mutool \- all purpose tool for dealing with PDF files

.SH SYNOPSIS
mutool <sub-command> [options]

.SH DESCRIPTION
mutool is a tool based on MuPDF for dealing with document files in various manners.
There are several sub commands available, as described below.

.SH DRAW
mutool draw [options] file [pages]
.PP
The draw command will render a document to image files,
convert to another vector format, or extract the text content.
.PP
The supported input document formats are: pdf, xps, cbz, and epub.
.PP
The supported output image formats are: pbm, pgm, ppm, pam, png, tga, pwg, pcl and ps.
The supported output vector formats are: svg, pdf, and debug trace (as xml).
The supported output text formats are: plain text, html, and structured text (as xml).
.TP
.B \-p password
Use the specified password if the file is encrypted.
.TP
.B \-o output
The output format is inferred from the output filename.
Embed %d in the name to indicate the page number (for example: "page%d.png").
Printf modifiers are supported, for example "%03d".
If no output is specified, the output will go to stdout.
.TP
.B \-F format
Enforce a specific output format. Only necessary when outputting to stdout
since normally the output filename is used to infer the output format.
.TP
.B \-R angle
Rotate clockwise by given number of degrees.
.TP
.B \-r resolution
Render the page at the specified resolution.
The default resolution is 72 dpi.
.TP
.B \-w width
Render the page at the specified width (or, if the -r flag is used,
render with a maximum width).
.TP
.B \-h height
Render the page at the specified height (or, if the -r flag is used,
render with a maximum height).
.TP
.B \-f
Fit exactly; ignore the aspect ratio when matching specified width/heights.
.TP
.B \-B bandheight
Render in banded mode with each band no taller than the given height. This uses
less memory during rendering. Only compatible with pam, pgm, ppm, pnm and png
output formats. Banded rendering and md5 checksumming may not be used at the
same time.
.TP
.B \-W width
Page width in points for EPUB layout.
.TP
.B \-H height
Page height in points for EPUB layout.
.TP
.B \-S size
Font size in points for EPUB layout.
.TP
.B \-U filename
User CSS stylesheet for EPUB layout.
.TP
.B \-c colorspace
Render in the specified colorspace.
Supported colorspaces are: mono, gray, grayalpha, rgb, rgbalpha, cmyk, cmykalpha.
Some abbreviations are allowed: m, g, ga, rgba, cmyka.
The default is chosen based on the output format.
.TP
.B -G gamma
Apply gamma correction.
Some typical values are 0.7 or 1.4 to thin or darken text rendering.
.TP
.B -I
Invert colors.
.TP
.B \-s [mft5]
Show various bits of information:
.B m
for glyph cache and total memory usage,
.B f
for page features such as whether the page is grayscale or color,
.B t
for per page rendering times as well statistics, and
.B 5
for md5 checksums of rendered images that can be used to check if rendering has
changed.
.TP
.B \-A bits
Specify how many bits of anti-aliasing to use. The default is 8.
.TP
.B \-D
Disable use of display lists. May cause slowdowns, but should reduce
the amount of memory used.
.TP
.B \-i
Ignore errors.
.TP
.B \-L
Low memory mode (avoid caching objects by clearing cache after each page).
.TP
.B \-P
Run interpretation and rendering at the smae time.
.TP
.B pages
Comma separated list of page numbers and ranges (for example: 1,5,10-15).
If no pages are specified, then all pages will be rendered.

.SH CLEAN
mutool clean [options] input.pdf [output.pdf] [pages]
.PP
The clean command pretty prints and rewrites the syntax of a PDF file.
It can be used to repair broken files, expand compressed streams, filter
out a range of pages, etc.
.PP
If no output file is specified, it will write the cleaned PDF to "out.pdf"
in the current directory.
.TP
.B \-p password
Use the specified password if the file is encrypted.
.TP
.B \-g
Garbage collect objects that have no references from other objects.
Give the option twice to renumber all objects and compact the cross reference table.
Give it three times to merge and reuse duplicate objects.
.TP
.B \-s
Rewrite content streams.
.TP
.B \-d
Decompress streams. This will make the output file larger, but provides
easy access for reading and editing the contents with a text editor.
.TP
.B \-l
Linearize output. Create a "Web Optimized" output file.
.TP
.B \-i
Toggle decompression of image streams. Use in conjunction with -d to leave
images compressed.
.TP
.B \-f
Toggle decompression of font streams. Use in conjunction with -d to leave
fonts compressed.
.TP
.B \-a
ASCII Hex encode binary streams. Use in conjuction with -d and -i or -f to
ensure that although the images and/or fonts are compressed, the resulting
file can still be viewed and edited with a text editor.
.TP
.B \-z
Deflate uncompressed streams.
If combined with -d, any decompressed streams will be recompressed.
If combined with -a, the streams will also be hex encoded after compression.
.TP
.B pages
Comma separated list of page numbers and ranges to include.

.SH EXTRACT
mutool extract [options] file.pdf [object numbers]
.PP
The extract command can be used to extract images and font files from a PDF.
If no object numbers are given on the command line, all images and fonts
will be extracted.
.TP
.B \-p password
Use the specified password if the file is encrypted.
.TP
.B \-r
Convert images to RGB when extracting them.

.SH INFO
mutool info [options] file.pdf [pages]
.PP
The info command lists the resources used on each page in a PDF file.
The default is to list all resource types, but if one
or more flags are given, only the flagged types will be shown.
.TP
.B \-p password
Use the specified password if the file is encrypted.
.TP
.B -F
List fonts.
.TP
.B -I
List images.
.TP
.B -M
List page dimensions.
.TP
.B -S
List shadings.
.TP
.B -P
List patterns.
.TP
.B -X
List form and postscript XObjects.
.TP
.B pages
Comma separated list of page numbers and ranges to include.

.SH CREATE
mutool create [-o output.pdf] [options] page1.txt [page2.txt ...]
.PP
The create command creates a new PDF file with the contents created
from one or more input files containing graphics commands.
.TP
.B \-o output
If no output file is specified, it will write the created PDF to "out.pdf"
in the current directory.
.TP
.B page.txt
A page is created for each input file, with the contents of the file copied
into the content stream. Special comments in the input files are parsed to
define the page dimensions and font and image resources:
.PP
%%MediaBox 0 0 500 800
.br
%%Rotate 90
.br
%%Font Tm Times-Roman
.br
%%Font Fn0 path/to/font/file.ttf
.br
%%Image Im0 path/to/image.png
.TP
.B \-O
Comma separated list of format specific output options:
.IP
.B decompress
.br
Decompress all object streams.
.IP
.B compress
.br
Compress all object streams.
.IP
.B compress-fonts
.br
Compress object streams for embedded fonts.
.IP
.B compress-images
.br
Compress object streams for images.
.IP
.B ascii
.br
Encode object streams using ASCII hex encoding.
.IP
.B pretty
.br
Pretty-print objects with indentation.
.IP
.B linearize
.br
Optimize document for progressive loading in viewers.
.IP
.B sanitize
.br
Clean up graphics command in content streams.
.IP
.B garbage[=compact|deduplicate]
.br
Garbage collect unused objects. With
.B compact
the cross-reference table will also be compacted. With
.B deduplicate
duplicate objects will also be recombined.

.SH PAGES
mutool pages [options] input.pdf [pages ...]
.PP
The pages command dumps information about the size and orientation
of pages within the document.
.TP
.B \-p password
Use the specified password if the file is encrypted.
.TP
.B pages
Comma separated list of page numbers and ranges to include.

.SH POSTER
mutool poster [options] input.pdf [output.pdf]
.PP
The poster command splits each page into tiles, and puts each tile on
a page of its own. It's useful for printing a large page onto smaller
pieces of paper that can then be glued together to create a large poster.
.TP
.B \-p password
Use the specified password if the file is encrypted.
.TP
.B \-x factor
Split the page into this many horizontal pieces.
.TP
.B \-y factor
Split the page into this many vertical pieces.
.PP
The output will have x times y number of pages for each input page.

.SH SHOW
mutool show [options] file.pdf [object numbers ...]
.PP
The show command will print the specified objects and streams to stdout.
Streams are decoded and non-printable characters are represented
with a period by default.
.TP
.B \-p password
Use the specified password if the file is encrypted.
.TP
.B \-o file
Write output to file instead of stdout.
.TP
.B \-b
Print streams as binary data and omit the object header.
.TP
.B \-e
Print streams in their original encoded (or compressed) form.
.PP
Specify objects by number, or use one of the following special names:
.TP
.B 'xref' or 'x'
Print the cross reference table.
.TP
.B 'trailer' or 't'
Print the trailer dictionary.
.TP
.B 'encrypt' or 'e'
Print the encryption dictionary.
.TP
.B 'pagetree' or 'p'
List the object numbers for every page.
.TP
.B 'grep' or 'g'
Print all the objects in the file in a compact one-line format suitable for piping to grep.
.TP
.B 'outline' or 'o'
Print the outline (table of contents).

.SH RUN
mutool run script.js [arguments]
.PP
Executes a Javascript program which has access to most of the features of the
MuPDF library. The command supports ECMAScript 5 syntax in strict mode. All of
the MuPDF constructors and function live in the global object, and the command
line arguments are accessible from the global argv object.
.PP
If invoke without any arguments, it will drop you into an interactive REPL
(read-eval-print-loop). On the interactive prompt, if you prefix a line with an
equal character it will automatically print the results of the line.
.PP
See the MuPDF documentation for details about the Javascript interfaces.

.SH CONVERT
mutool convert [options] file [pages]
.PP
The convert commant is used to convert a file from one format to another.
.TP
.B \-p password
Use the specified password if the file is encrypted.
.TP
.B \-A bits
Specify how many bits of anti-aliasing to use. The default is 8.
.TP
.B \-W width
Page width in points for EPUB layout.
.TP
.B \-H height
Page height in points for EPUB layout.
.TP
.B \-S size
Font size in points for EPUB layout.
.TP
.B \-U filename
User CSS stylesheet for EPUB layout.
.TP
.B \-o output
The output format is inferred from the output filename.
Embed %d in the name to indicate the page number (for example: "page%d.png").
Printf modifiers are supported, for example "%03d".
If no output is specified, the output will go to stdout.
.TP
.B \-F format
Enforce a specific output format. Only necessary when outputting to stdout
since normally the output filename is used to infer the output format.
.TP
.B \-O
Comma separated list of format specific output options:

.SH MERGE
mutool merge [options] file1 [pages] file2 [pages] ...
.PP
The merge command is used to pick out pages from two or more files and merge
them in order into a new output file.
.TP
.B \-o output
The output filename.
.TP
.B \-O
See mutool create for details on this option.

.SH SEE ALSO
.BR mupdf (1),

.SH AUTHOR
MuPDF is Copyright 2006-2016 Artifex Software, Inc.