officefileapi-devexpress-dot-pdf-dot-pdffileattachment-9c1cb815.md
Gets or sets date when the file attachment was created in the document.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public DateTimeOffset? CreationDate { get; set; }
Public Property CreationDate As DateTimeOffset?
| Type | Description |
|---|---|
| Nullable<DateTimeOffset> |
A nullable DateTimeOffset structure that is a valid date-time offset.
|
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