Menghapus lampiran

Menghapus semua lampiran

  1. Ikat PDF sumber ke fasad PdfContentEditor.
  2. Panggil deleteAttachments() untuk menghapus setiap lampiran tersemat.
  3. Simpan dokumen PDF yang diperbarui.
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();
    }
}