Travailler avec les Pièces Jointes

Comment ajouter une pièce jointe en utilisant PdfContentEditor

public static void AttachmentDemo01()
{
    PdfContentEditor editor = new PdfContentEditor(new Document(_dataDir + "sample.pdf"));
    editor.addDocumentAttachment(_dataDir + "file_example_MP3_700KB.mp3", "Fichier MP3 de démonstration");
    editor.save(_dataDir + "PdfContentEditorDemo07.pdf");
}
public static void AttachmentDemo02()
{
    PdfContentEditor editor = new PdfContentEditor(new Document(_dataDir + "sample.pdf"));
    FileInputStream fileStream=null;
    try {
        fileStream = new FileInputStream(_dataDir + "file_example_MP3_700KB.mp3");
    } catch (FileNotFoundException e) {            
        e.printStackTrace();
    }
    editor.addDocumentAttachment(fileStream, "file_example_MP3_700KB.mp3", "Fichier MP3 de démonstration");
    editor.save(_dataDir + "PdfContentEditorDemo08.pdf");
}

Comment supprimer une pièce jointe à l’aide de PdfContentEditor

public static void DeleteAllAttachments()
{
    AttachmentDemo02();
    PdfContentEditor editor = new PdfContentEditor(new Document(_dataDir + "PdfContentEditorDemo07.pdf"));
    // Supprimer toutes les pièces jointes
    editor.deleteAttachments();
    editor.save(_dataDir + "PdfContentEditorDemo09.pdf");
}