Skip to main content
All docs
V26.1
  • Attachment.MimeType Property

    Gets or sets the Multipurpose Internet Mail Extensions (MIME) type of the attached file.

    Namespace: DevExpress.Docs.Pdf

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

    Declaration

    public string MimeType { get; set; }

    Property Value

    Type Description
    String

    The MIME type of the attached file.

    Remarks

    Use the MimeType property to specify the MIME type of the attached file (for example, “text/plain”).

    Example

    How to: Attach a File to a PDF File

    The following code snippet attaches a file to a PDF document.

    using DevExpress.Docs.Pdf;
    
    using (PdfDocument pdfDocument =
        new PdfDocument(File.OpenRead(@"document_001.pdf")))
    
    {
        var attachment = new Attachment();
        attachment.Data = File.ReadAllBytes(@"C:\Documents\test.pdf");
        attachment.Relationship = AssociatedFileRelationship.Supplement;
        attachment.FileName = "attachment.pdf";
        attachment.CreationDate = DateTime.Now;
        attachment.MimeType = "application/pdf";
    
        pdfDocument.Attachments.Add(attachment);
    
        using (FileStream outputStream = File.Create(@"document_001_with_attachment.pdf"))
        {
            pdfDocument.Save(outputStream);
        }
    }
    
    See Also