Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar
Find #mupdf on Discord
Do you have any feedback on this page?

# mutool merge

The `merge` command is used to pick out pages from two or more files and merge them into a new output file.

    mutool merge [-o output.pdf] [-O options] input.pdf [pages] [input2.pdf] [pages2] ...

Note

Command line parameters within square brackets `[]` are optional.

`[-o output.pdf]`

  The output filename. Defaults to “out.pdf” if not supplied.

`[-O options]`

  Comma separated list of output options.

  - `decompress` Decompress all streams (except compress-fonts/images).

  - `compress` Compress all streams.

  - `compress-fonts` Compress embedded fonts.

  - `compress-images` Compress images.

  - `ascii` ASCII hex encode binary streams.

  - `pretty` Pretty-print objects with indentation.

  - `linearize` Optimize for web browsers.

  - `clean` Pretty-print graphics commands in content streams.

  - `sanitize` Sanitize graphics commands in content streams.

  - `incremental` Write changes as incremental update.

  - `continue-on-error` Continue saving the document even if there is an error.

  - `garbage` Garbage collect unused objects.

    > or `garbage=compact` … and compact cross reference table.

    > or `garbage=deduplicate` … and remove duplicate objects.

  - `decrypt` Write unencrypted document.

  - `encrypt=rc4-40|rc4-128|aes-128|aes-256` Write encrypted document.

  - `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` Regenerate document id (default yes).

`input.pdf`

  The first document.

`[pages]`

  Comma separated list of page ranges for the first document (`input.pdf`). The first page is “1”, and the last page is “N”. The default is “1-N”.

`[input2.pdf]`

  The second document.

`[pages2]`

  Comma separated list of page ranges for the second document (`input2.pdf`). The first page is “1”, and the last page is “N”. The default is “1-N”.

`...`

  Indicates that we add as many additional `[input]` & `[pages]` pairs as required to merge multiple documents.

Do you have any feedback on this page?

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 artifex.com or contact Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, CA 94129, USA, for further information.