Extract Pages from PDF
Contents
[
Hide
]
Extract pages from a PDF
The Java sample extracts pages 1, 4, and 3 into a new PDF document.
Steps
- Create a
PdfFileEditorinstance. - Define the page numbers to extract.
- Call
extractwith the source file, page array, and output file. - Save the extracted pages as a new PDF.
Java example
public static void extractPagesFromPdf(Path inputFile, Path outputFile) {
PdfFileEditor pdfEditor = new PdfFileEditor();
pdfEditor.extract(inputFile.toString(), new int[] {1, 4, 3}, outputFile.toString());
}