Remove Attachments
Contents
[
Hide
]
Remove all attachments
- Bind the source PDF to the
PdfContentEditorfacade. - Call
deleteAttachments()to remove every embedded attachment. - Save the updated PDF document.
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();
}
}