> 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/split.md).

# Split PDFs from command-line

Split PDF documents based on manually defined page ranges with PageMaster. Learn how to split by odd/even pages, reverse order, page sets, and more. Find syntax examples and customization tips here! T

## Split by Pages

You can split PDF documents based on manually defined page ranges with multitude of available options such as odd/even pages, reverse order, page ranges, page sets, etc.

**Syntax:**

`pagemaster (-s or --split)<input>,<pagelist1>,<pagelist2>`

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

### Examples

The following command-line will split 'in.pdf' and all PDF documents in 'MyPDFs' folder into individual PDF documents:

`pagemaster -s in.pdf MyPDFs -o OutDir`

The last option (-o OUT) instructs PageMaster to store all resulting documents in the new folder called 'OutDir'.

The splitting 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 extract the first five pages from 'in.pdf':

`pagemaster -s in.pdf,1-5`

For a detailed description of how to specify 'page-lists' as part of 'Split-By-Page' 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 splitting process:

Split 'in.pdf' into a set of PDF documents containing 2 pages each:

`pagemaster -s in,2x`

Split 'in.pdf' into two parts. The first PDF will contain pages 1 through 10, and the second document contains the remainder of the document:

`pagemaster -s in,1-10,11-`

The above command-line will break 'in.pdf' into several parts: A PDF containing pages 1 through 5, a PDF containing pages 6 to 10 (in the reverse order), and a set of odd pages in the page rage from page 15 to the last page in the document:

`pagemaster -s in,1-5,10-6,15-odd`

### **File Naming Convention**

Generally, by setting the '--digits' option, all numbers will be replaced by numbers with that number of digits: --digits \<numdigits>

* If the user specifies a page range \<firstpage>-\<lastpage>(i.e. 1-5), then the created file will become \<original file name>\_\<firstpage>-\<lastpage> regardless of whether \<firstpage> or \<lastpage> are in the document.
* If - is specified, then the resulting filename is \<original file name>\_1-last.pdf
* If e or o is specified, then the resulting filename is \<original file name>\_\<e or o>.pdf
* If \<firstpage>-\<lastpage>\<e or o> is specified, then the resulting filename is \<original file name>\_\<firstpage>-\<lastpage>\<e or o>
* If <# pages per doc>x is specified and <# pages per doc> is not 1, then each file created has the filename \<original file name>\_\<start page>-(\<start page> + <# pages per doc>)

> Even if the last document contains less than (\<start page> + <# pages per doc>) pages

* If 1x is specified or no pagelist is specified (1x is used as the default), then each file created has the filename \<original file name>\_\<page number>
* If \<page number> is specified, then a file is created (with just that one page) with the filename \<original file name>\_\<page number>

## Split by Bookmarks

Most PDF utilities offer the ability to break documents by first or second level bookmarks only. With PDF PageMaster, you can split PDF documents by any bookmark level while retaining bookmarks and links in output files.

\--bybookmarks \<depth> will cause PDF PageMaster to split the pages of the given file based on the destinations of bookmarks that are at that depth in the bookmark tree. (Please note that pagelists are ignored if the '--bybookmarks' option is specified.)

\--bybookmarks \<depth1>,\<depth2> will cause PDF PageMaster to split the pages of a given file based on the destinations of bookmarks that are at a depth between depth1 and depth2 in the bookmark tree.

### **Examples**

Split 'in.pdf' based on the destinations of the root bookmarks (usually chapters etc.):

`pagemaster -s \--bybookmarks 1 in.pdfpagemaster -s \--bybookmarks 1,1 in.pdf`

Split 'in.pdf' based on root bookmark as well as the second level bookmark destinations:

`pagemaster -s \--bybookmarks 1,2 in.pdf`

Split 'in.pdf' based on 3rd level bookmark destinations:

`pagemaster -s \--bybookmarks 3 in.pdf`

### **File Naming Convention**

The file is named by the pages that it contains

\<original file name>\_\<firstpage>-\<lastpage> where firstpage is never larger than lastpage

## **Split by File Size**

You can specify the size of your PDF files and PDF PageMaster will split the PDFs to the closest possible kilobyte.

\--byfilesize \<filesize> will cause PDF PageMaster to attempt to split with the file size of each created file being less than \<filesize> KB. (It may not succeed in doing that if any one page is larger than \<filesize> KB.)

### **Examples (assuming that each page can fit into the size provided)**

Split largepdf.pdf into files of size 1000 KB or less:

`pagemaster -s \--byfilesize 1000 largepdf.pdf`

Split largepdf.pdf into files of size 232 KB or less:

`pagemaster -s \--byfilesize 232 largepdf.pdf`

### **File Naming Convention**

The file is named by the pages that it contains

\<original file name>\_\<firstpage>-\<lastpage> where firstpage is never larger than lastpage


---

# 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/split.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.
