> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/cli/pdf-pagemaster/usage/merge.md).

# Merging PDFs from command-line - Windows, Linux and Mac.

Merge multiple PDF documents easily with PageMaster. Select specific pages, ranges, odd/even pages, and more for a customized output. Learn how to use 'page-lists' for precise merging. Try it now! The

PageMaster lets you to easily merge multiple PDF documents into a single output PDF document through CLI on Windows, Linux and Mac. You can select all pages or just a selected subset of pages (specific pages, page ranges, odd/even pages, etc) to be copied from each input document.

For a description of how to specify a pagelist as part of this operation, please refer to Section 4.8 of this user manual.

**Syntax:**

`pagemaster (-m or --merge)<input1.PDF>,<pagelist1>,<pagelist2> <input2.PDF>,<pagelist3> <PDF folder> <input3.PDF> etc.`

To merge a list of PDF documents, specify -m (or --merge) on the command-line followed by a list of one or more PDF documents to split.

## Examples

The following command-line will merge 'in1.pdf', 'in2.pdf' and all PDF documents in 'MyPDFs' folder into a file called 'merged.pdf':

`pagemaster --m in1.pdf in2.pdf MyPDFs -o Output/merged.pdf`

The last option (-o merged.pdf) instructs PDF PageMaster to save the merged document in the new folder called 'Output'.

The merging process can be fine-tuned with a 'page list' parameter that can immediately follow the input PDF filename (after comma). For example, the following command-line will merge the first five pages from 'in.pdf' and all PDF files stored in the 'MyPDFs' folder:

`pagemaster -m in.pdf,1-5 MyPDFs,1-5`

For a detailed description of how to specify 'page-lists' as part of the PDF merge operation, please refer to Section 4.8 of this user manual.

The following are some additional examples of how to use 'page-lists' to customize the merging process:

Merge all even pages from 'in1.pdf' with all odd pages from 'in2.pdf':

`pagemaster -m in1.pdf,e in2.pdf,o -o out.pdf`

Merge a PDF document by pulling pages 1 and 4 from 'in1.pdf', followed by a page range 5-10 (in the reverse order), followed by off pages in the rage 10-5 from 'in2.pdf', followed by all even pages from PDF files located under InDir1 folder:

`pagemaster -m in1.pdf,1,4,10-5 in2.pdf,10-5o InDir1,e \--subfolders -o merged.pdf`

By default, '--merge' will append the pages from the second file to the pages from the first file and so on. However, if the '--splice' option is used, the merge function will interweave the documents. For example:

`pagemaster -m in1.pdf in2.pdf in3.pdf -o out.pdf`

will merge in1.pdf in2.pdf and in3.pdf to create a larger document out.pdf (in1.pdf followed by in2.pdf followed by in3.pdf)

`pagemaster -m in1.pdf in2.pdf in3.pdf \--splice -o out.pdf`

In the above command-line, the document 'out.pdf' will be created starting with page 1 of 'in1.pdf'. Then page 1 of in2.pdf and then page 1 of 'in3.pdf'. It will continue in this manner until a document runs out of pages and then the other two will be interweaved in this manner until all pages are inserted.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/cli/pdf-pagemaster/usage/merge.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
