使用 Java 删除 PDF 文件中的图像
Contents
[
Hide
]
当需要从 PDF 页面中删除嵌入图像时,请使用页面图像资源集合。
通过索引删除嵌入的图像
public static void deleteImage(Path inputFile, Path outputFile) {
try (Document document = new Document(inputFile.toString())) {
document.getPages().get_Item(1).getResources().getImages().delete(1);
document.save(outputFile.toString());
}
}