mutool
Manipulate and convert PDF and related files
TLDR
Convert a range of pages to PNGs (Note: %nd in the output placeholder must be replaced with a print modifier like %d or %2d)
Convert one or more pages of a PDF into text in stdout
Concatenate multiple PDF files
Query information about all content embedded in a PDF
Extract all images, fonts and resources embedded in a PDF to the current directory
Show the outline (table of contents) of a PDF
SYNOPSIS
mutool command [options] [arguments...]
PARAMETERS
convert
Converts documents between various formats (e.g., PDF to PNG, PDF to EPUB, XPS to PDF). Supports image, text, and document output formats.
draw
Renders document pages to image files (e.g., PNG, JPEG, TIFF) or displays them. Useful for previewing or generating thumbnails.
info
Displays detailed information about a document, including metadata, structure, and object contents. Useful for debugging and analysis.
clean
Rewrites and sanitizes PDF files, often used to fix corruptions, linearize for web viewing, or optimize file size by garbage collection.
extract
Extracts images, fonts, and other embedded resources from a document. Resources are typically saved as separate files.
poster
Splits large document pages into multiple smaller tiles, facilitating printing of oversized documents on standard paper sizes.
merge
Combines multiple PDF documents into a single output PDF file. (Availability may depend on MuPDF build options.)
show
Decompresses and displays the raw content of specified PDF objects, aiding in understanding PDF internal structure.
DESCRIPTION
The mutool command is a powerful and efficient command-line utility provided as part of the MuPDF software suite. It acts as a versatile toolkit for manipulating, converting, displaying, and inspecting various document formats, primarily PDF and XPS files.
Known for its speed and small footprint, mutool leverages MuPDF's rendering engine to perform a wide array of tasks. It supports operations such as converting documents to different formats (images, other document types), extracting embedded resources (images, fonts), displaying document information, cleaning and optimizing PDF files, and even creating new PDF documents from basic inputs. Its functionality is organized into distinct subcommands, making it a comprehensive solution for document processing needs directly from the terminal.
CAVEATS
The exact set of supported formats and available subcommands for mutool can vary depending on how the MuPDF library was compiled and packaged by your distribution. Some advanced features, like merge, might not be universally available. Always back up original documents before performing potentially destructive operations like clean or convert.
MULTITOOL DESIGN
Unlike many other Linux commands that perform a single specific task, mutool is designed as a 'multitool'. Its core functionality is delivered through various subcommands (e.g., convert, draw, info), each handling a distinct aspect of document processing. Users specify the desired operation via the first argument after mutool.
HISTORY
mutool is an integral part of the MuPDF project, an open-source, lightweight PDF and XPS viewer and toolkit developed by Artifex Software. It originated as a command-line interface to expose the powerful rendering and document manipulation capabilities of the underlying MuPDF library, known for its speed and compact design. Its development mirrors that of MuPDF itself, continually evolving to support new features and formats while maintaining its performance focus.