JPedal provides several methods to allow easy page extraction from PDF files.
These tools will allow you to create a copy of the PDF with only the content from the specified pages. The original file is left untouched by this process unless you overwrite it with the output.
Extract a single Page from PDF with the Command-Line or another language
java -cp jpedal.jar org.jpedal.manipulator.PdfManipulator --isolatePage inputFile outputFile pagesToExtract
Extract Pages from PDF in Java
When extracting a page range you can use the SetOfIntegerSyntax
to define multiple ranges to extract into the output file.
final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"))
.isolatePage(new PageRanges("1-2"))
.apply()
.writeDocument(new File("outputFile.pdf"));
pdf.closeDocument();
pdf.reset();