class procedure SetDeterministicTime(FixedEpoch: Int64);
| FixedEpoch | Int64. Time PDFium should report, as seconds since the Unix epoch |
PDFium reads the system clock when it writes creation and modification dates and other time-derived values. Two runs of the same code therefore produce two different files, which breaks byte-comparison in tests and reproducible builds
Fixing the clock makes the output depend only on the input. This is a class method, so it applies to every TPdf instance in the process, and it stays in effect until RestoreActualTime is called
It takes effect only when the loaded PDFium module exports the time hook; on a module without it the call is accepted but the clock is not overridden
TPdf.SetDeterministicTime(1700000000);
try
Pdf.SaveAs('reproducible.pdf');
finally
TPdf.RestoreActualTime;
end;