Link
Skip to main content

Extract Pages From PDF

v2024.08

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.tools.PdfPageExtraction inputFile outputFile pageToExtract

Extract Pages from PDF in Java

Static Convenience Methods

When extracting a page range you can use the SetOfIntegerSyntax to define multiple ranges to extract into the output file.

//Extract all pages between rangeStart and rangeEnd inclusive
PdfPageExtraction.extractPageRange(new File("inputFile.pdf"), new File("outputFile.pdf"), rangeStart, rangeEnd);

//Extract all pages defined by the page range string using the SetOfIntegerSyntax
PdfPageExtraction.extractPageRange(new File("inputFile.pdf"), new File("outputFile.pdf"), stringPageRange);

//Extract a single page
PdfPageExtraction.extractSinglePage(new File("inputFile.pdf"), new File("outputFile.pdf"), singlePageNumber);

Get started with JPedal in 3 steps

  1. Fill in the form to download the trial jar →
  2. Copy the code snippets as instructed on the next page
  3. Build your solution using our docs

Learn more about JPedal

Start Your Free Trial


Customer Downloads

Select Download