删除附件
Contents
[
Hide
]
删除所有附件
- 将源 PDF 绑定到
PdfContentEditor对象。 - 调用
deleteAttachments()删除所有嵌入的附件。 - 保存更新后的 PDF 文档。
public static void removeAttachments(Path inputFile, Path outputFile) {
PdfContentEditor editor = new PdfContentEditor();
try {
editor.bindPdf(inputFile.toString());
editor.deleteAttachments();
editor.save(outputFile.toString());
} finally {
editor.close();
}
}