Link
Skip to main content

Split PDF Files

v2025.05

JPedal is a pure Java PDF library which provides developers with several methods to allow for easy splitting of PDF files into multiple new files. The original file is left untouched by this process.

Split PDF into many files

To split a PDF into many files with a set amount of pages per new file, use the following code. The final file contains the remainder of pages so may have fewer pages than the rest.

int pagesPerFile = 3;
PdfManipulator.splitIntoPages(new File("inputFile.pdf"), new File("outputFolder"), pagesPerFile);

If you want to split a password-protected file, add the password as the last argument.

PdfManipulator.splitIntoPages(new File("inputFile.pdf"), new File("outputFolder"), pagesPerFile, "password");

Split PDF into two files

To split a PDF into just two files, use the following code. The first file will contain all pages up to and including pageToSplitAt, and the second file will contain the rest.

int pageToSplitAt = 10;
PdfManipulator.splitInHalf(new File("/path/to/input.pdf"), new File("/path/to/output-folder"), pageToSplitAt);

If you want to split a password-protected file, add the password as the last argument.

PdfManipulator.splitInHalf(new File("/path/to/input.pdf"), new File("/path/to/output-folder"), pageToSplitAt, "password");

Split PDFs with the command line

You may also call the split functions from the command line which allows you to access JPedal from any language or tool.

java -cp jpedal.jar org.jpedal.manipulator.PdfManipulator --splitIntoPages inputFile outputFolder pagesPerFile
java -cp jpedal.jar org.jpedal.manipulator.PdfManipulator --splitInHalf inputFile outputFolder pageToSplitAt

Why JPedal?

  • Actively developed commercial library with full support and no third party dependencies.
  • Process PDF files up to 3x faster than alternative Java PDF libraries.
  • Simple licensing options and source code access for OEM users.

Learn more about JPedal

Start Your Free Trial


Customer Downloads

Select Download