TL;DR Java has no PDF support in the standard library, so splitting a PDF means adding a third-party library. With JPedal it is one static call on PdfManipulator: splitIntoPages() to break a file into chunks of N pages (pass 1 for single pages), or splitInHalf() to cut it in two at a page you choose. Splitting writes new files and leaves the original PDF untouched.
Contents:
Why split a PDF in Java?
Large documents often need cutting up before anything else can happen to them. Common cases:
- Invoice processing: separating a bulk PDF into individual client invoices.
- Archiving: breaking a large report into chapter-based files.
- Security: pulling the non-sensitive pages out of a confidential document so they can be shared publicly.
Requirements
To add JPedal to a Maven project:
- Download the JPedal trial jar.
- Install the jar to your local Maven repository:
mvn install:install-file -Dfile=<path-to-JPedal-jar> -DgroupId=com.idrsolutions -Dpackaging=jar -DartifactId=jpedal -Dversion=1.0
- Add it to your project:
<dependencies>
<dependency>
<groupId>com.idrsolutions</groupId>
<artifactId>jpedal</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
If you would rather pull JPedal from our Maven repository than install the jar by hand, see adding JPedal as a Maven dependency.
How to split a PDF using JPedal
JPedal’s PdfManipulator class has two static methods for splitting. Each takes the input file, an output folder, and a page number or page count, so there is no document to load or close yourself.
Split a PDF file into single pages
PdfManipulator.splitIntoPages(new File("/path/to/input.pdf"), new File("/path/to/output-folder"), 1);
Split a PDF file into two files
Pass the page to split at. The first file contains pages up to and including pageToSplitAt, and the second file contains the rest.
PdfManipulator.splitInHalf(new File("/path/to/input.pdf"), new File("/path/to/output-folder"), pageToSplitAt);
Split a PDF file into multiple files
Pass the number of pages you want in each file. Every file gets pagesPerNewFile pages, apart from the last one, which gets whatever is left over.
PdfManipulator.splitIntoPages(new File("/path/to/input.pdf"), new File("/path/to/output-folder"), pagesPerNewFile);
Split a password-protected PDF file
Both methods have an overload that takes the password as a final parameter. It is a byte[], not a String:
PdfManipulator.splitIntoPages(new File("/path/to/input.pdf"), new File("/path/to/output-folder"), 1, "password".getBytes());
Before and after
Notice how the original file remains untouched.


Splitting is one of many operations PdfManipulator handles. For rotating, removing and adding pages, stamping text and images, or redaction, see how to edit a PDF in Java. To go the other way and combine files, see PDF merge in Java.
Frequently asked questions
Does splitting a PDF affect the quality of the pages?
No. When using JPedal, the pages are extracted as-is. The vector graphics, images, and text resolution remain identical to the original source.
How do I handle large PDF files efficiently?
For very large files, ensure your JVM has sufficient heap memory allocated. JPedal is optimized to handle large documents by streaming content where possible.
Can I split a PDF in Java without an external library?
Technically, but it means writing a PDF parser from scratch, which is highly complex. Using a dedicated library like JPedal is standard practice, as it handles compression, encryption, and cross-reference tables correctly.
We have been working with PDFs for over 25 years and have other resources to help you learn more about the PDF format.