从 PDF 中提取页面
Contents
[
Hide
]
从 PDF 中提取页面
该 Java 示例将第 1、4、3 页提取到新的 PDF 文档中。
步骤
- 创建一个
PdfFileEditor实例。 - 定义要提取的页码。
- 调用
extract使用源文件、页数组和输出文件。 - 将提取的页面保存为新的 PDF。
Java 示例
public static void extractPagesFromPdf(Path inputFile, Path outputFile) {
PdfFileEditor pdfEditor = new PdfFileEditor();
pdfEditor.extract(inputFile.toString(), new int[] {1, 4, 3}, outputFile.toString());
}