Delete Pages from PDF
Contents
[
Hide
]
Delete pages from a PDF
The Java sample removes pages 2 and 4 from the source document.
Steps
- Create a
PdfFileEditorinstance. - Build an array with the page numbers to remove.
- Call
deletewith the input file, page array, and output file. - Save the resulting PDF.
Java example
public static void deletePagesFromPdf(Path inputFile, Path outputFile) {
PdfFileEditor pdfEditor = new PdfFileEditor();
pdfEditor.delete(inputFile.toString(), new int[] {2, 4}, outputFile.toString());
}