Skip to main content
All docs
V25.1
  • Attachment Class

    A file attached to a PDF document.

    Namespace: DevExpress.Docs.Pdf

    Assembly: DevExpress.Docs.Core.v25.1.dll

    NuGet Package: DevExpress.Docs.Core

    Declaration

    public class Attachment

    Example

    The following code snippet attaches a PDF file to the exported presentation:

    using DevExpress.Docs.Pdf;
    using DevExpress.Docs.Presentation;
    using DevExpress.Docs.Presentation.Export;
    //...
    using (var presentation = new Presentation(File.ReadAllBytes(@"C:\Documents\Presentation.pptx")))
    {
        var attachment = new Attachment();
        attachment.Data = File.ReadAllBytes(@"C:\Documents\test.pdf");
        attachment.Relationship = AttachmentRelationship.Supplement;
        attachment.FileName = "attachment.pdf";
        attachment.CreationDate = DateTime.Now;
        attachment.Type = "application/pdf";
    
        PdfExportOptions options = new PdfExportOptions();
        options.Attachments.Add(attachment);
    
        presentation.ExportToPdf(new FileStream("C:\\Documents\\Presentation.pdf", FileMode.Create, FileAccess.ReadWrite), options);
    }
    

    Inheritance

    Object
    Attachment
    See Also