OptionalcompressFlate-compress content and CMap streams. On by default; tests turn it off to read the operators back out of the file.
Optionalcreation/CreationDate, as a PDF date string (D:YYYYMMDDHHmmSSZ). Omitted by
default, and that is deliberate: a clock read here would make the output
unreproducible, so a caller that wants a date must supply one it chose.
OptionalfileProject-relative path diagnostics are attributed to — the entrypoint, as far as a reader is concerned. Emission failures have no single source line, so they are reported against the file as a whole.
OptionalmaxReject rather than allocate above this size. Unset means no cap.
Optionalproducer/Producer.
Optionaltitle/Title. Omitted when unset.
PDF emission: positioned pages in, bytes out.
This is the bottom of the engine. It does no layout, no measurement and no I/O — it receives
Pages whose every coordinate is already decided and turns them into a PDF 1.7 file with each face embedded as a subset.It never throws.
compile()has a catch-all above it, but relying on that would report an emission failure as an anonymous engine bug; failures are turned into diagnostics here, where there is enough context to name what went wrong.pdfisnullwhenever an error-severity diagnostic was produced.It is deterministic. The same
Page[]produces byte-identical output on every run and every machine. That is a requirement, not a nicety — it is what lets a test assert on bytes at all. Three things had to be pinned for it: no creation date (seecreationDate), a/IDhashed from content rather than from a clock (serialize.ts), and subset tags derived from a font's position in the document rather than from pdf-lib's random suffix (subset.ts).