Back to Devexpress

PdfFileAttachment.CreationDate Property

officefileapi-devexpress-dot-pdf-dot-pdffileattachment-9c1cb815.md

latest2.9 KB
Original Source

PdfFileAttachment.CreationDate Property

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

Declaration

csharp
public DateTimeOffset? CreationDate { get; set; }
vb
Public Property CreationDate As DateTimeOffset?

Property Value

TypeDescription
Nullable<DateTimeOffset>

A nullable DateTimeOffset structure that is a valid date-time offset.

|

Example

View Example

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

PdfFileAttachment Class

PdfFileAttachment Members

DevExpress.Pdf Namespace