PdfDateTime extension type

Represents a PDF date/time string defined in PDF 32000-1:2008, 7.9.4 Dates

pdfDateString is a PDF date string. The date string should be in D:YYYYMMDDHHmmSSOHH'mm' format as specified in the PDF standard. But this class do permissive parsing and allows missing some of the components. To validate the format, use isValidFormat.

on

Constructors

PdfDateTime(String pdfDateString)
const
PdfDateTime.fromDateTime(DateTime dateTime)
Creates a PdfDateTime from a DateTime object.
PdfDateTime.fromYMDHMS(int year, int month, int day, int hour, int minute, int second, {int timeZoneOffset = 0})
Creates a PdfDateTime from individual date and time components.

Properties

day → int
Day (1-31)
no setter
hour → int
Hour (0-23).
no setter
isValidFormat → bool
Checks if the PDF date/time string is in a valid format or not.
no setter
minute → int
Minute (0-59).
no setter
month → int
Month (1-12)
no setter
pdfDateString → String
final
second → int
Second (0-59).
no setter
timezoneOffset → int
no setter
year → int
Year (e.g., 2025)
no setter

Methods

canonicalize() → PdfDateTime
Returns a canonicalized PdfDateTime with all components filled in.
toDateTime() → DateTime
UTC DateTime representation of the PDF date/time string.

Static Methods

fromPdfDateString(String? pdfDateString) → PdfDateTime?
Creates a PdfDateTime from a nullable PDF date string.