mutool clean#

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.

mutool clean [options] input.pdf [output.pdf] [pages]


Command line parameters within square brackets [] are optional.


Options are as follows:

-p password

Use the specified password if the file is encrypted.


Garbage collect unused objects.


In addition to -g compact xref table.


In addition to -gg merge duplicate objects.


In addition to -ggg check streams for duplication.


Linearize PDF.


Save file without encryption.

-E encryption

Save file with new encryption (rc4-40, rc4-128, aes-128, or aes-256).

-O owner_password

Owner password (only if encrypting).

-U user_password

User password (only if encrypting).

-P permission

Permission flags (only if encrypting).


ASCII hex encode binary streams.


Decompress streams.


Deflate uncompressed streams.


Compress font streams.


Compress image streams.


Clean content streams.


Sanitize content streams.


Create appearance streams for annotations.


Recreate appearance streams for annotations.


Preserve metadata.


Input file name. Must be a PDF file.


The output file. Must be a PDF file.


If no output file is specified, it will write the cleaned PDF to “out.pdf” in the current directory.


Comma separated list of page numbers and ranges. If no pages are supplied then all document pages will be considered for the output file.

This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that license. Refer to licensing information at or contact Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, CA 94129, USA, for further information.

Discord logo