officefileapi-devexpress-dot-pdf-dot-pdffileattachment-c507273b.md
Specifies the description for the attached file shown in the Attachments panel of a PDF Viewer.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public string Description { get; set; }
Public Property Description As String
| Type | Description |
|---|---|
| String |
A string that is an attached file description.
|
Use the Description property to specify a description for the attached file, which helps to differentiate between similar files in the Attachments panel of the PDF Viewer.
using DevExpress.Pdf;
using System;
using System.IO;
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 attached file.",
FileName = "MyAttach.txt",
Data = File.ReadAllBytes("..\\..\\..\\FileToAttach.txt"),
MimeType = "text/plain",
Relationship = PdfAssociatedFileRelationship.Supplement,
});
// The attached document.
processor.SaveDocument("..\\..\\Result.pdf");
}
Imports DevExpress.Pdf
Imports System
Imports System.IO
Shared Sub Main(ByVal args() As String)
Using processor As New PdfDocumentProcessor()
' Load a document.
processor.LoadDocument("..\..\Document.pdf")
' Attach a file to the PDF document.
processor.AttachFile(New PdfFileAttachment() With { _
.CreationDate = Date.Now, _
.Description = "This is my attached file.", _
.FileName = "MyAttach.txt", _
.Data = File.ReadAllBytes("..\..\FileToAttach.txt"), _
.MimeType = "text/plain",
.Relationship = PdfAssociatedFileRelationship.Supplement
})
' The attached document.
processor.SaveDocument("..\..\Result.pdf")
End Using
End Sub
See Also