Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

PdfFileAttachment.FileName Property

Gets or sets the attached file name.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v19.1.Core.dll

Declaration

public string FileName { get; set; }

Property Value

Type Description
String

A string value that is the name of an attached file.

Example

This example shows how to programmatically attach a file to the PDF document.

To do this:

using DevExpress.Pdf;
using System;
using System.IO;

namespace AttachFile {
    class Program {
        static void Main(string[] args) {

            using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {
                // Load a document.
                processor.LoadDocument("..\\..\\Document.pdf");

                // Attach a file to the PDF document. 
                processor.AttachFile(new PdfFileAttachment() {
                    CreationDate = DateTime.Now,
                    Description = "This is my attach file.",
                    FileName = "MyAttach.txt",
                    Data = File.ReadAllBytes("..\\..\\FileToAttach.txt")
                });

                // The attached document.
                processor.SaveDocument("..\\..\\Result.pdf");
            }
        }
    }
}
See Also