The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

PdfFileAttachment Class

Represents an attachment where a file can be embedded to a PDF document.

Namespace: DevExpress.Pdf

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

Declaration

public class PdfFileAttachment
Public Class PdfFileAttachment
public class PdfFileAttachment
Public Class PdfFileAttachment

Remarks

You can specify the file attachment creation date (the PdfFileAttachment.CreationDate property), modification date (the PdfFileAttachment.ModificationDate property), content data of an attached file (the PdfFileAttachment.Data property), the attached file name (the PdfFileAttachment.FileName property), description (the PdfFileAttachment.Description property) and other settings.

Examples

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");
            }
        }
    }
}

Inheritance

Object
PdfFileAttachment
See Also