Skip to main content
All docs
V26.1
  • FileSpecification Class

    The file specification that includes the target file name in a standard format and information for specific file systems.

    Namespace: DevExpress.Docs.Pdf

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

    NuGet Package: DevExpress.Docs.Pdf

    Declaration

    public class FileSpecification :
        ICloneable

    Example

    How to: Create a File Attachment Annotation

    The following code snippet creates a file attachment annotation and embeds a text file:

    file attachment annotation pdf api for dot net

    using DevExpress.Docs.Pdf;
    using System.Drawing;
    
    using (PdfDocument pdfDocument =
        new PdfDocument(File.OpenRead(@"Document.pdf")))
    {
        // Create a file attachment annotation
        FileAttachmentAnnotation annotation =
             new FileAttachmentAnnotation(
                     new RectangleF(50, 420, 20, 20));
        annotation.Content = "Project specification";
        annotation.Title = "John Smith";
        annotation.IconName = FileAttachmentAnnotationIconName.PaperClip;
    
        // Create a file data for the attachment
        FileSpecification fileSpecification = new FileSpecification();
        fileSpecification.FileName = "Specification.pdf";
        fileSpecification.FileData = File.ReadAllBytes(Path.Combine(Directory.GetCurrentDirectory(), "Specification.pdf"));
        fileSpecification.Description = "Project specification";
    
        annotation.FileSpecification = fileSpecification;
    
        // Add the annotation to the first page of the PDF document
        pdfDocument.Pages[0].Annotations.Add(annotation);
    
        pdfDocument.Save(File.OpenWrite(@"DocumentWithAnnotation.pdf"));
    }
    

    Implements

    Inheritance

    Object
    FileSpecification
    See Also