Удаление вложений

Удаление всех вложений

  1. Привяжите исходный PDF к фасаду PdfContentEditor.
  2. Вызовите deleteAttachments(), чтобы удалить каждое встроенное вложение.
  3. Сохраните обновлённый 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();
    }
}