Remover anexos

Remover todos os anexos

  1. Vincule o PDF de origem à fachada PdfContentEditor.
  2. Chame deleteAttachments() para remover todos os anexos incorporados.
  3. Salve o documento PDF atualizado.
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();
    }
}