[]
        
(Showing Draft Content)

GrapeCity.Documents.Pdf.PdfDateTime

PdfDateTime Struct

Represents a PDF DateTime type.

Implements
Namespace: GrapeCity.Documents.Pdf
Assembly: DS.Documents.Pdf.dll
Syntax
public struct PdfDateTime : IEquatable<PdfDateTime>
Public Structure PdfDateTime
    Implements IEquatable(Of PdfDateTime)
Remarks

The PDF Specification does not define a special type for DateTime values, such values are stored as strings in a special format, similar to (D:YYYYMMDDHHmmSSOHH'mm'), see the spec for details (PDF 1.7 chapter 3.8.3).

But there are many PDF documents in which DateTime strings are specified in some custom format, for example using a regional format. GcPdf uses this struct when processing such values. Where possible, the value is converted to DateTimeOffset, otherwise it preserves the original string value.

Constructors

Name Description
PdfDateTime(IPdfString)

Initializes a new instance of the PdfDateTime struct using a IPdfString. The passed string is converted to DateTimeOffset if possible.

PdfDateTime(DateTime)

Initializes a new instance of the PdfDateTime struct using a DateTime value.

PdfDateTime(string)

Initializes a new instance of the PdfDateTime struct using a string. The passed string is converted to DateTimeOffset if possible.

Properties

Name Description
DateTimeOffset

Gets the DateTimeOffset value defined by this PdfDateTime. Throws an exception if this PdfDateTime is represented by an unparsed string.

DateTimeValue

Gets the DateTime value representing local time. Throws an exception if this PdfDateTime is represented by an unparsed string.

IsString

Gets a value indicating whether this PdfDateTime struct contains a string value which cannot be converted to DateTime.

Value

Gets the IPdfString representing the value of this PdfDateTime.

Methods

Name Description
DateTimeToPdfString(DateTime)

Converts a DateTime value to a string in PDF format as described in PDF 1.7 specification chapter 3.8.3.

DateTimeToPdfString(DateTimeOffset)

Converts a DateTimeOffset value to a string in PDF format as described in PDF 1.7 specification chapter 3.8.3.

Equals(PdfDateTime)

Checks whether this PdfDateTime is equal to another PdfDateTime.

Equals(object)
GetHashCode()
ToString()
ToString(string)

Converts this PdfDateTime to string, using a specified format if the current struct holds a DateTime value.

TryParse(string, out DateTimeOffset)

Tries to convert a string to DateTimeOffset. See PDF 1.7 specification chapter 3.8.3.

Operators

Name Description
operator ==(PdfDateTime, PdfDateTime)

The equality operator.

implicit operator PdfDateTime(DateTime)

Converts a DateTime value to PdfDateTime.

operator !=(PdfDateTime, PdfDateTime)

The inequality operator.