Some test text!

Hamburger Icon

Cli / Guides / Merge PDF

Merging PDFs from command-line

PageMaster lets you to easily merge multiple PDF documents into a single output PDF document. 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.


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.


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.

Get the answers you need: Chat with us