comparison mupdf-source/docs/tools/mutool-clean.rst @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 mutool clean
2 ==========================================
3
4 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.
5
6 .. code-block:: bash
7
8 mutool clean [options] input.pdf [output.pdf] [pages]
9
10 ``[options]``
11 Options are as follows:
12
13 ``-p`` password
14 Use the specified password if the file is encrypted.
15
16 ``-g``
17 Garbage collect unused objects.
18
19 ``-gg``
20 In addition to ``-g`` compact xref table.
21
22 ``-ggg``
23 In addition to ``-gg`` merge duplicate objects.
24
25 ``-gggg``
26 In addition to ``-ggg`` check streams for duplication.
27
28 ``-l``
29 Linearize PDF (no longer supported!).
30
31 ``-D``
32 Save file without encryption.
33
34 ``-E`` encryption
35 Save file with new encryption (``rc4-40``, ``rc4-128``, ``aes-128``, or ``aes-256``).
36
37 ``-O`` owner_password
38 Owner password (only if encrypting).
39
40 ``-U`` user_password
41 User password (only if encrypting).
42
43 ``-P`` permission
44 Permission flags (only if encrypting).
45
46 ``-a``
47 ASCII hex encode binary streams.
48
49 ``-d``
50 Decompress streams.
51
52 ``-z``
53 Deflate uncompressed streams.
54
55 ``-f``
56 Compress font streams.
57
58 ``-i``
59 Compress image streams.
60
61 ``-c``
62 Pretty-print graphics commands in content streams.
63
64 ``-s``
65 Sanitize graphics commands in content streams.
66
67 ``-t``
68 Compact object syntax.
69
70 ``-tt``
71 Use indented object syntax to make PDF objects more readable.
72
73 ``-L``
74 Print comments containing labels showing how each object can be reached from the Root.
75
76 ``-A``
77 Create appearance streams for annotations that are missing appearance streams.
78
79 ``-AA``
80 Recreate appearance streams for all annotations.
81
82 ``-m``
83 Preserve metadata.
84
85 ``-S``
86 Subset fonts if possible. (EXPERIMENTAL!)
87
88 ``-Z``
89 Use object streams cross reference streams for extra compression.
90
91 ``--(color|gray|bitonal)-(|lossy-|lossless-)image-subsample-method method``
92 Set the subsampling method (``average``, or ``bicubic``) for the desired image types, for example color-lossy and bitonal-lossless.
93
94 ``--(color|gray|bitonal)-(|lossy-|lossless-)image-subsample-dpi dpi``
95 Set the resolution at which to subsample.
96
97 ``--(color|gray|bitonal)-(|lossy-|lossless-)image-recompress-method quality``
98 Set the recompression quality to either of ``never``, ``same``, ``lossless``, ``jpeg``, ``j2k``, ``fax``, or ``jbig2``.
99
100 ``--structure=keep|drop``
101 Keep or drop the structure tree.
102
103 ``input.pdf``
104 Input file name. Must be a PDF file.
105
106 ``[output.pdf]``
107 The output file. Must be a PDF file.
108
109 If no output file is specified, it will write the cleaned PDF to "out.pdf" in the current directory.
110
111 ``[pages]``
112 Comma separated list of page numbers and ranges (for example:
113 1,5,10-15,20-N), where the character N denotes the last page. If no
114 pages are specified, then all pages will be included.