summaryrefslogtreecommitdiff
path: root/docs/manual-mutool-convert.html
blob: 06a3fe06f89908c316c0ebf77d86e3082296ec13 (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
<!DOCTYPE html>
<html>
<head>
<title>mutool convert</title>
<link rel="stylesheet" href="style.css" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>

<header>
<h1>mutool convert</h1>
</header>

<nav>
<a href="http://mupdf.com/index.html">About</a>
<a href="http://mupdf.com/news.html">News</a>
<a href="index.html">Documentation</a>
<a href="http://mupdf.com/downloads/">Downloads</a>
<a href="http://git.ghostscript.com/?p=mupdf.git;a=summary">Source</a>
<a href="https://bugs.ghostscript.com/">Bugs</a>
</nav>

<article>

<p>
The 'mutool convert' command converts an input file into another format.

<pre>
mutool convert [options] -o <i>output input</i> [pages]
</pre>

<p>
The command line options are:

<dl>
<dt><i>input</i>
	<dd>Input file name.
	The input can be any of the document formats supported by MuPDF: PDF, XPS, CBZ, unprotected EPUB, FB2, etc.
<dt>[pages]
	<dd>Comma separated list of page ranges. The first page is "1", and the last page is "N". The default is "1-N".
<dt>-p <i>password</i>
	<dd>Password to use for password protected PDF documents.
</dl>

<dl>
<dt>-o <i>filename</i>
	<dd>The output file name.
	The output file name may have a "%d" in the path, which will be replaced with the page number.
	If there is no %d, the page number will be appended at the end of the file name for single page formats.
<dt>-F <i>format</i>
	<dd>The output format. If missing, it is inferred from the output file name extension.
	See below for which formats are supported.
<dt>-O <i>options</i>
	<dd>Comma separated list of output options.
	The set of available options varies depending on the output format.
	See below for details.
</dl>

<dl>
<dt>-A <i>bits</i>
	<dd>Number of bits of anti-aliasing to use (0 to 8) when rendering to image based formats. The default is 8.
<dt>-W <i>width</i>
	<dd>Page width in points for EPUB layout.
<dt>-H <i>height</i>
	<dd>Page height in points for EPUB layout.
<dt>-S <i>font-size</i>
	<dd>Font size in points for EPUB layout.
<dt>-U <i>stylesheet.css</i>
	<dd>File name of user style sheet for EPUB layout.
<dt>-X
	<dd>Disable document styles for EPUB layout.
</dl>

<h2>
Image output
</h2>

<p>
CBZ (comic book zip) is a multi-page image format.

<p>
The following single page image formats are also supported: PNG, PNM, PAM, TGA, PBM, PKM.
Each page is written to a separate file.

<p>
The output options (-O flag) for image formats are:

<dl>
<dt>rotate=<i>N</i>		<dd>Rotate rendered pages <i>N</i> degrees counter-clockwise.
<dt>resolution=<i>N</i>		<dd>Set both X and Y resolution in pixels per inch.
<dt>x-resolution=<i>N</i>	<dd>Set X resolution in pixels per inch.
<dt>y-resolution=<i>N</i>	<dd>Set Y resolution in pixels per inch.
<dt>width=<i>N</i>		<dd>Render pages to fit <i>N</i> pixels wide (ignore resolution options).
<dt>height=<i>N</i>		<dd>Render pages to fit <i>N</i> pixels tall (ignore resolution options).
<dt>colorspace=gray/rgb/cmyk	<dd>Render using specified colorspace (if output format supports it).
<dt>alpha			<dd>Render pages with an alpha channel and transparent background (if output format supports it).
</dl>

<h2>
PDF output
</h2>

<p>
With PDF output, we will create a new PDF file that matches the visual appearance.
The PDF output is still a work in progress, so some features may not work.

<p>
If the input is PDF, the output will have nothing in common except the visual appearance.
All bookmarks, annotations, forms, etc, will be thrown away. If you want to do a PDF to PDF
conversion, 'mutool clean' is a better tool to use.

<p>
The PDF output options are:

<dl>
<dt>decompress			<dd> Decompress all streams (except compress-fonts/images).
<dt>compress			<dd> Compress all streams.
<dt>compress-fonts		<dd> Compress embedded fonts.
<dt>compress-images		<dd> Compress images.
<dt>ascii			<dd> ASCII hex encode binary streams.
<dt>pretty			<dd> Pretty-print objects with indentation.
<dt>linearize			<dd> Optimize for web browsers.
<dt>sanitize			<dd> Clean up graphics commands in content streams.
<dt>garbage			<dd> Garbage collect unused objects.
<dt>garbage=compact		<dd> ... and compact cross reference table.
<dt>garbage=deduplicate		<dd> ... and remove duplicate objects.
</dl>

<h2>
SVG output
</h2>

<p>
SVG output is a single page format, so we will write one SVG file for each input page.

<p>
The SVG output options are:

<dl>
<dt>text=text		<dd> Emit text as <text> elements (inaccurate fonts).
<dt>text=path		<dd> Emit text as <path> elements (accurate fonts).
<dt>no-reuse-images	<dd> Do not reuse images using &lt;symbol&gt; definitions.
</dl>

</article>

<footer>
<a href="http://artifex.com"><img src="artifex-logo.png" align="right"></a>
Copyright &copy; 2006-2017 Artifex Software Inc.
</footer>

</body>
</html>