property CreationDate: WString; // read only
CreationDate returns the /CreationDate entry from the document
Information dictionary (PDF 1.7 spec section 14.3.3) as the raw PDF date literal. The
value is formatted as D:YYYYMMDDHHmmSSOHH'mm' — for example
D:20231201090000Z for 09:00 UTC on 1 December 2023, or
D:20260514103015+08'00' for 10:30:15 in UTC+08:00 (PDF 1.7 spec
section 7.9.4).
The string is empty when Active is False, when the
document does not declare an Info dictionary, or when no /CreationDate
entry was written. Most authoring tools record this timestamp at the moment the PDF is
first produced and then leave it untouched; ModifiedDate reflects later
edits. Comparing CreationDate to ModifiedDate is a quick way to identify whether a
PDF has been edited since its initial export.
Parsing the date string requires stripping the D: prefix, decoding the
fixed-width fields, then interpreting the trailing timezone offset (the apostrophe is
part of the literal syntax). PDFiumVCL exposes the raw text so callers can apply their
preferred conversion: build a TDateTime, format with locale-specific
rules, or feed into a regex / parser that handles the various truncations producers
use.
Z (UTC), +HH'mm',
-HH'mm', or absent altogether — treat absence as “local
time, unknown offset”./CreationDate identical to
/ModDate — do not rely on a difference between the two as
proof of editing.DateTimeToStr using FormatSettings.
var Created, Modified: WString;
Created := Pdf1.CreationDate;
Modified := Pdf1.ModifiedDate;
if (Created <> '') and (Created <> Modified) then
Log.Add('Document edited since creation');