Link

Split Pages From PDF

JPedal provides several methods to allow easy splitting of PDF files into multiple new files.
These tools will allow you to create multiple PDF files by splitting a given file into multiple new files. The original file is left untouched by this process.

This feature is currently in preview as of version 2024.01
Preview features API are not finalised and may change. Preview features are available for users to test and provide feedback before they are released.

Split a PDF into two files with the Command-Line or another language

java -cp jpedal.jar org.jpedal.tools.PdfPageSplit 
inputFile outputFile pageToSplitAt

The pageToSplitAt variable defines which page of the file to split at. The first half of the file contains the specified page.

Split PDF files in Java

Static Convenience Methods

//Split all pages into separate PDF files, all output has the same file name with the page number appended
PdfPageSplit.splitAllPages(new File("/path/to/input.pdf"), new File("/path/to/output.pdf"));

//Split the file into multiple new files with pagePerNewFile pages each and any remainder in the final file
PdfPageSplit.splitToNPagePDFs(new File("/path/to/input.pdf"), new File("/path/to/output.pdf"), pagePerNewFile);

//Split a PDF file into 2 files where the first page contains pages 1-pageToSplitAt inclusive, the second contains all other pages
PdfPageSplit.splitIn2(new File("/path/to/input.pdf"), new File("/path/to/output.pdf"), pageToSplitAt);