MUTOOL(1) General Commands Manual MUTOOL(1) NAME mutool - all purpose tool for dealing with PDF files SYNOPSIS mutool sub-command [options] 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. VERSION mutool -v Shows the MuPDF version used to build mutool. AUDIT mutool audit [options] file1.pdf [file2.pdf ...] Outputs a report of operator and space usage for each given PDF file. -o filename The output filename for the report. BAKE mutool bake [options] input.pdf [output.pdf] Normally annotations and form field widgets are separate content streams that get drawn on top of the page contents. This command bakes annotations and/or widgets into the page contents, making them inseparable. After baking in annotations and widgets they are just visual representaitons of what the original annotation/widget looked like, their properties can no longer be edited since they no longer exist as proper annotation/widgets. -A Do not bake in annotations. -F Do not bake in form field widgets. -O options A comma-separated list of PDF options. See PDF OUTPUT OPTIONS below. BARCODE mutool barcode -d [options] file1.pdf [pages1] [file2.pdf] [pages2] Decodes a barcode from an image or a document. -p password Use the specified password if the file is encrypted. -o output The output filename. If no output is specified, any text from decoded barcodes will go to stdout. -r angle Hwo much to rotate the input pages in degrees (0-360), before trying to decode any barcodes. pages Comma-separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page. If no pages are specified, then all pages will be processed. mutool barcode -c [options] text Creates a new barcode containing text argument and formatted according to options specified. -o output The output format is inferred from the output filename, either PNG or PDF. If no output is specified, the default is out.png -F format The desired output barcode format: aztec codabar code39 code93 code128 databar databarexpanded datamatrix ean8 ean13 itf maxicode pdf417 qrcode upca upce microqrcode rmqrcode dxfilmedge databarlimited -s size Set size in pixels for the output barcode. If not specified the smallest size that can be decoded is chosen. -q Add quiet zones around the barcode. This puts an empty margin around created barcodes. -t Add human-readable text, when available. Some barcodes, e.g. EAN-13, may have the barcode contents printed in human-readable text next to the barcode, which is enabled by this flag. -t level Set error correction level (0-8). Some barcodes, e.g. QR-codes, support several levels of error correction, which can be customized through this option. text The text to be encoded into a barcode. CLEAN mutool clean [options] input.pdf [output.pdf] [pages ...] 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. If no output file is specified, it will write the cleaned PDF to "out.pdf" in the current directory. -p password Use the specified password if the file is encrypted. -g Garbage collect objects that have no references from other objects. -gg In addition to -g, also renumber all objects and compact the cross reference table. -ggg In addition to -gg, also merge and reuse duplicate objects. -gggg In addition to -ggg, also merge and reuse duplicate streams. -l No longer supported! Linearize output. Used to create a "Web Optimized" output file. -D Save file without encryption. -E method Save file with desired encryption method, one of: rc4-40,rc40-128,aes-128, or aes-256. -O password Owner password used when encrypting output file. This is required to edit the output file. -U password User password used when encrypting output file. This is required to view the output file. -P permissions Permissions used when encrypting output file. These are the permissions that apply when the output file is viewed. -a ASCII Hex encode binary streams. Use in conjunction 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. -d Decompress streams. This will make the output file larger, but provides easy access for reading and editing the contents with a text editor. -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. -e effort Configure how much effort is spent compressing the output file. 0 is default amount, otherwise a percentage of the maximum effort, 1 for minimum and 100 for maximum effort. -f Toggle decompression of font streams. Use in conjunction with -d to leave fonts compressed. -i Toggle decompression of image streams. Use in conjunction with -d to leave images compressed. -c Pretty-print graphics commands in content streams. -s Sanitize graphics commands in content streams, this means, for example, removing invalid or redundant commands. -t Use compact PDF object syntax. This saves space. -tt Use indented PDF object syntax. This is more human-readable. -L Print comments containing labels showing how each object can be reached from the Root. -v Transform all text into vector graphics commands. -A Create appearance streams for annotations that are missing appearance streams. -AA Recreate appearance streams for all annotations. -m Preserve metadata. -S Subset fonts if possible. (EXPERIMENTAL!) -Z Use object streams cross reference streams for extra compressoin. --(color|gray|bitonal)-(|lossy-|lossless-)image-subsample-method=method Set the subsampling method (average or bicubic) for the desired image types, for example color-lossy and bitonal-lossless. --(color|gray|bitonal)-(|lossy-|lossless-)image-subsample-dpi=dpi[,dpi] Set the resolution at which to subsample. --(color|gray|bitonal)-(|lossy-|lossless-)image-recompress-method=quality Set the recompression quality to either of never, same, lossless, jpeg, j2k, fax, or jbig2. --recompress-images-when=(smaller|always) Recompress images when the rewritten images by the subsampling- or recompression methods above are smaller (default), or always recompress them. --structure=(keep|drop) Keep or drop the structure tree. pages Comma-separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page. If no pages are specified, then all pages will be included. CONVERT mutool convert [options] input.pdf [pages ...] The convert command is used to convert a file from one format to another. -p password Use the specified password if the file is encrypted. -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. -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. -O options Comma-separated list of format specific output options, see PDF OUTPUT OPTIONS and OUTPUT OPTIONS below. -b box Use named page box (MediaBox, CropBox, BleedBox, TrimBox, or ArtBox). -A bits Specify how many bits of anti-aliasing to use. The default is 8. -W width Page width in points for EPUB layout. -H height Page height in points for EPUB layout. -S size Font size in points for EPUB layout. -U filename User CSS stylesheet for EPUB layout. -X Disable document styles for EPUB layout. pages Comma-separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page. If no pages are specified, then all pages will be rendered. CREATE mutool create [-o output.pdf] [options] page.txt [page2.txt ...] The create command creates a new PDF file with the contents created from one or more input files containing graphics commands. -o output If no output file is specified, it will write the created PDF to "out.pdf" in the current directory. -O options Comma-separated list of format specific output options, see PDF OUTPUT OPTIONS below. 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: %%MediaBox LLX LLY URX URY Set the page size (default A4). %%Rotate Angle Set the page rotation (default 90 degrees). %%Font Name Filename Encoding Create a simple font resource using the declared Name. Filename can be either a font file or one of the Base-14 font names (Times-Roman, etc). Encoding is one of Latin (for ISO-8859-1), Greek (for ISO-8859-7) or Cyrillic (for KOI-8). %%Font Name Language WMode Style Language Create a CID font resource for CJK scripts using the declared Name. Language is one of zh-Hant, zh-Hans, ja, or ko. Wmode is one of H, or V. Style is serif, or sans. %%Image Im0 path/to/image.png Create an image resource. COMPLETE EXAMPLE This adds an image, a triangle and some text to a page: %%MediaBox 0 0 595 842 %%Font TmRm Times-Roman %%Font Helv-C Helvetica Cyrillic %%Font Helv-G Helvetica Greek %%CJKFont Song zh-Hant %%CJKFont Mincho ja %%CJKFont Batang ko %%Image I0 docs/examples/huntingofthesnark.png % Draw an image. q 480 0 0 480 50 250 cm /I0 Do Q % Draw a triangle. q 1 0 0 rg 50 50 m 100 200 l 200 50 l f Q % Show some text. q 0 0 1 rg BT /TmRm 24 Tf 50 760 Td (Hello, world!) Tj ET BT /Helv-C 24 Tf 50 730 Td Tj ET BT /Helv-G 24 Tf 50 700 Td Tj ET BT /Song 24 Tf 50 670 Td <4F60 597D> Tj ET BT /Mincho 24 Tf 50 640 Td <3053 3093 306b 3061 306f> Tj ET BT /Batang 24 Tf 50 610 Td Tj ET Q DRAW mutool draw [options] file [pages ...] The draw command will render a document to image files, convert to another vector format, or extract the text content. The supported input document formats are: pdf, xps, cbz, md, and epub. The supported output image formats are: pbm, pgm, ppm, pam, png, 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 or json). -p password Use the specified password if the file is encrypted. -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. -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. -q Be quiet, do not print progress messages. -R angle Rotate clockwise by given number of degrees. -r resolution Render the page at the specified resolution. The default resolution is 72 dpi. -w width Render the page at the specified width (or, if the -r flag is used, render with a maximum width). -h height Render the page at the specified height (or, if the -r flag is used, render with a maximum height). -f Fit exactly; ignore the aspect ratio when matching specified width/heights. -b box Use named page box (MediaBox, CropBox, BleedBox, TrimBox, or ArtBox). -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. -T threads Number of threads to use for rendering (banded mode only). -W width Page width in points for EPUB layout. -H height Page height in points for EPUB layout. -S size Font size in points for EPUB layout. -U filename User CSS stylesheet for EPUB layout. -X Disable document styles for EPUB layout. -a Disable usage of accelerator file. -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. -e filename Proof ICC profile filename to use for rendering. -G gamma Apply gamma correction. Some typical values are 0.7 or 1.4 to thin or darken text rendering. -I Invert colors. -s [mft5] Show various bits of information: m for glyph cache and total memory usage, f for page features such as whether the page is grayscale or color, t for per page rendering times as well statistics, and 5 for md5 checksums of rendered images that can be used to check if rendering has changed. -A bits Specify how many bits of anti-aliasing to use. The default is 8. -A bits/bits Specify how many bits of anti-aliasing to use. The default is 8. Bits for graphics is before the slash, bits for text after the slash. -l width Minimum stroked line width (in pixels). -K Do not draw text. -KK Only draw text. -D Disable use of display lists. May cause slowdowns, but should reduce the amount of memory used. -i Ignore errors. -m limit Limit memory usage in bytes. -L Low memory mode (avoid caching objects by clearing cache after each page). -P Run interpretation and rendering at the same time. -N Disable ICC workflow. -M overprint Control spot/overprint rendering: 0 for no spot rendering, 1 for Overprint simulation Overprint simulation (default), or 2 for full spot rendering. -t language Specify language/script for OCR (default: eng) -d ocr-file-path Specify path for OCR files (default: rely on TESSDATA_PREFIX environment variable. -k correction Set the skew correction, either one of auto, 0 for increase size, 1 for maintain size, or 2 for decrease size. -k correction,angle Set the skew correction as well as the angle. -y l Print the layer configs to stderr. -y layer-number Select layer config (by number from -y l ). -y layer-number,item1,item2, ... Select layer config (by number from -y l ) and toggle the listed items. -Y Print the individual layers to stderr. -z layer-number Hide individual layer. -Z layer-number Show individual layer. pages Comma-separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page. If no pages are specified, then all pages will be rendered. EXTRACT mutool extract [options] file.pdf [object-number ...] 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. -p password Use the specified password if the file is encrypted. -r Convert images to RGB when extracting them. -a Embed SMasks as alpha channel.. -N Do not use ICC color conversions. INFO mutool info [options] file.pdf [pages ...] 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. -p password Use the specified password if the file is encrypted. -F List fonts. -I List images. -M List page dimensions. -P List patterns. -S List shadings. -X List form and postscript XObjects. -Z List ZUGFeRD info. pages Comma-separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page. If no pages are specified, then all pages will be included. MERGE mutool merge [options] file1 [pages1] [file2 [pages2] ...] The merge command is used to pick out pages from two or more files and merge them in order into a new PDF output file. -o output The output filename. -O options Comma-separated list of format specific output options, see PDF OUTPUT OPTIONS below. PAGES mutool pages [options] input.pdf [pages ...] The pages command dumps information about the size and orientation of pages within the document. -p password Use the specified password if the file is encrypted. pages Comma-separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page. If no pages are specified, then all pages will be included. POSTER mutool poster [options] input.pdf [output.pdf] 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. -p password Use the specified password if the file is encrypted. -m margin Margin (overlap) between pages in points or percent. -x factor Split the page into this many horizontal pieces. -y factor Split the page into this many vertical pieces. -r Splits hoirzontally from right to left (default splits from left to right). The output will have x times y number of pages for each input page. RECOLOR mutool recolor [options] input.pdf Change the color space used in a PDF to a desired one. This command can, for example, change a color PDF to be grayscale. -c colorspace Desired output colorspace, choose one of gray (default), rgb, or cmyk. -o filename The output filename. -r Remove any output intents. RUN mutool run script.js [arguments] 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. 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. See the MuPDF documentation at https://mupdf.readthedocs.io for details about the Javascript interfaces. SHOW mutool show [options] file.pdf [object-number ...] 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. -p password Use the specified password if the file is encrypted. -o file Write output to file instead of stdout. -e Print streams in their original encoded (or compressed) form. -b Print streams as binary data and omit the object header. -g Print each object on a single line, suitable for grep. -r Force repair before showing any objects. -L Show object labels (how to reach an object from the root). Specify what to show by using one of the following keywords, or a path to an object: 'trailer' Print the trailer dictionary. 'xref' Print the cross reference table. 'pages' List the object numbers for every page. 'grep' Print all the objects in the file in a compact one-line format suitable for piping to grep. 'outline' Print the outline (also known as "table of contents" or "bookmarks"). 'js' Print document level Javascript. 'form' Print form objects. A path starts with either an object number, a property in the trailer dictionary, or the keyword trailerorpages. Separate elements with a period . or slash /. Select a page object by using pages/N where N is the page number. The first page is number 1. * You can use * as an element to iterate over all array indices or dictionary properties in an object. SIGN mutool sign [options] input.pdf [signature-object-number ...] Reads a PDF file and prints information about each signature field object. With suitable options all or specified signatures can be verified, cleared or signed. -p password Use the specified password if the file is encrypted. -v Verify all signatures, or only the specified signature. -c Clear all signatures, or only the specified signature. -s certificate-filename Read a certificate from the given filename and use it to sign all, or just the specified signature. -P certificate-password Use the specified password when opening the certificate. -o filename The output filename. signature object numbers A list of PDF object number for signatures to verify/clear/sign. If no such object numbers are given, all signatures will be processed. TRACE mutool trace [options] file1 [pages1] [file2 [pages2] ...] Prints a trace of device calls needed to render the desired pages from the given document. -p password Use the specified password if the file is encrypted. -b box Which box to trim to, either one of: (MediaBox (default), CropBox, BleedBox, TrimBox, or ArtBox). -W width Page width in points for EPUB layout. -H height Page height in points for EPUB layout. -S size Font size in points for EPUB layout. -U filename User CSS stylesheet for EPUB layout. -X Disable document styles for EPUB layout. -d Enable use of display lists. pages Comma-separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page. If no pages are specified, then all pages will be rendered. TRIM mutool trim [options] input.pdf Makes a modified version of a PDF with content that falls inside (or outside) of the given box removed. -b box Which box to trim to, either one of: (MediaBox (default), CropBox, BleedBox, TrimBox, or ArtBox). -f Fallback to mediabox if specified box not available. -m all Add same margins to all sides of the box, where all is positive for inwards, negative for outwards. -m vertical,horizontal Add specific margins for vertical and horizontal sides of the box, where verticalandhorizontal are positive for inwards, negative for outwards. -m top,right,bottom,left Add specific margins for top, right, bottom and left sides of the box, where top, right, bottom, and left each are positive for inwards, negative for outwards. -e Exclude contents of box rather than include them. -o filename The output filename. OUTPUT OPTIONS Configuring output is done by a comma-separated list of output options. Raster output options These apply to output formats: cbz, png, pnm, pgm, ppm, pam, pbm, pkm. rotate=N Rotate rendered pagess N degrees counterclockwise. resolution=N Set both X and Y resolution to N pixels per inch. x-resolution=N Set X resolution of rendred pages in pixels per inch. y-resolution=N Set Y resolution of rendred pages in pixels per inch. width=N Render pages to fit N pixels wide (ignore resolution option). height=N Render pages to fit N pixels tall (ignore resolution option). colorspace=(gray|rgb|cmyk) Render pages using the specified colorspace. alpha Render pages with alpha channel and transparent background. graphics=(aaN|cop|app) and text=(aaN|cop|app) Set the rasterizer to use for graphics or text respectively: aaN Antialias with N bits (0 to 8). cop Center of pixel. app Any part of pixel. PCL options These apply to print-raster output formats: pcl, pclm, ps, pwg. colorspace=(mono|rgb) Render 1-bit black and white or a full color page. preset=(generic|ljet4|dj500|fs600|lj|lj2|lj3|lj4|lj4pl|lj4d|lp2563b|oce9050) Render 1-bit black and white or a full color page. spacing=(0|1|2|3) Set vertical spacing to none, PCL 3 (*p+Y), PCL 5 (*bY), or PCL 6 (*bY and clear seed row). mode2 Enable mode 2 graphics compression. mode3 Enable mode 3 graphics compression. eog_reset End of graphics (+rB) resets all parameters. has_duplex Duplex supported (&lS). has_papersize Papersize setting supported (&lA). has_copies Number of copies supported (&lX). is_ljet4pjl Disable/enable HP 4PJL model-specific output. is_oce9050 Disable/enable Oce 9050 models-specific output. PCLm options These apply only to: pclm. compression=(none|flate) No compression (default), or enable flate compression. strip-height=N Strip height (default 16). PWG options These apply only to: pwg. media_class=string Set the media_class field. media_color=string Set the media_color field. media_type=string Set the media_type field. output_type=string Set the output_type field. rendering_intent=string Set the rendering_intent field. page_size_name=string Set the page_size_name field. advance_distance=int Set the advance_distance field. advance_media=int Set the advance_media field. collate=int Set the collate field. cut_media=int Set the cut_media field. duplex=int Set the duplex field. insert_sheet=int Set the insert_sheet field. jog=int Set the jog field. leading_edge=int Set the leading_edge field. manual_feed=int Set the manual_feed field. media_position=int Set the media_position field. media_weight=int Set the media_weight field. mirror_print=int Set the mirror_print field. negative_print=int Set the negative_print field. num_copies=int Set the num_copies field. orientation=int Set the orientation field. output_face_up=int Set the output_face_up field. page_size_x=int Set the page_size_x field. page_size_y=int Set the page_size_y field. separations=int Set the separations field. tray_switch=int Set the tray_switch field. tumble=int Set the tumble field. media_type_num=int Set the media_type_num field. compression=int Set the compression field. row_count=int Set the row_count field. row_feed=int Set the row_feed field. row_step=int Set the row_step field. SVG options These apply only to: svg. text=text Emit text as elements (inaccurate fonts). text=path Emit text as elements (accurate fonts). no-reuse-images Do not reuse image using definitions. Text options These apply to output formats: html, xhtml, text, stext. preserve-images Keep imagess in output. preserve-ligatures Do not expand ligature into constituent characters. preserve-spans Do not merge spans on the same line. preserve-whitespace Do not convert all whitespace into space characters. inhibit-spaces Do not add spaces between gaps in the text. paragraph-break Break blocks at paragraph boundaries. dehyphenate Attempts to join up hyphenated words. ignore-actualtext Do not apply ActualText replacements. use-cid-for-unknown-unicode Use character code if unicode mapping fails. use-gid-for-unknown-unicode Use glyph index if unicode mapping fails. accurate-bboxes Calculate bboxes from the outlines. accurate-ascenders Calculate ascender/descender from font glyphs. accurate-side-bearings Expand character bboxes to completely include width of glyphs. collect-styles Attempt to detect text features (fake bold, strikeout, underlined, etc.) clip Do not include text that is completely clipped. clip-rect=x0:y0:x1:y1 Specify clipping rectangle within which to collect content. structured Collect structure markup. vectors Include vector bboxes in output. lazy-vectors Delay vectors in the extraction that would otherwise split a text line. fuzzy-vectors Merge abutting horizontal and vertical vectors. segment Attempt to segment the page. table-hunt Hunt for tables within a (segmented) page. vertically-collapse-bordered-cells (experimental) If true, consider the contents of completely bordered super- cells as being vertically collapsible. PDF OUTPUT OPTIONS These apply only to: PDF. decompress Decompress all streams (except compress-fonts/images). compress=(yes|flate|brotli) Compress all streams, if no value is given, or the value is yes the default is to use flate. compress-fonts Compress object stream for embedded fonts. compress-images Compress object streams for images. compress-effort=(0|percentage) Effort spent compressing, 0 is default, otherwise percentage of max effort. ascii Encode object streams using ASCII hex encoding. pretty Pretty-print objects with indentation. labels Print object labels. linearize No longer supported! Optimize document for progressive loading in viewers. clean Pretty-print graphics commands in content streams. sanitize Clean up graphics command in content streams. garbage Garbage collect unused objects. garbage=compact Garbage collect unused object, and compact cross reference table. garbage=deduplicate Garbage collect unused objects, compact cross reference table, and recombine duplicate objects. incremental Write changes as incremental update. objstms Use object streams and cross reference streams. appearance=(yes|all) Synthesize just missing, or all, annotation/widget appearance streams. continue-on-error Continue saving the document even if there is an error. decrypt This option is deprecated: instead of decrypt use encrypt=none. encrypt=(none|keep|rc4-40|rc4-128|aes-128|aes-256) Write encrypted document using specified encryption method. The default value is keep. permissions=number Document permissions to grant when encrypting. user-password=password Password required to read document. owner-password=password Password required to edit document. regenerate-id=(yes|no) Regenerate document id (default yes). reproducible=(yes|no) Attempt to make produced documents reproducible (default no). EXIT STATUS The exit status is 0 upon successful execution and non-zero upon error. SEE ALSO mupdf(1), AUTHOR MuPDF is Copyright 2004-2026 Artifex Software, Inc. June 3, 2026 MUTOOL(1)