Expand description
Content-stream serialization: pdfboss_core::content::Op values back to
operator syntax. The writer emits from the same IR the reader parses
into, so parse_content(serialize_ops(ops)) == ops is the module’s
defining property — every variant of Op must round-trip.
Inline images emit exactly the dictionary entries present in
ImageParams::dict, never an invented /L: the parser keeps a
declared length key (/L or /Length) in the parsed dictionary, so
re-emitting the entries reproduces the trusted length, and data
containing a spurious EI round-trips whenever the dictionary
carries one — the only way the parser can produce such data. Without a
length key the parser stops at the first EI token boundary, so
parser-produced data never contains a premature boundary and re-locating
EI finds the true end. The parser skips one whitespace byte after ID
and strips one before EI; the writer emits exactly one of each.
Two parser-producible corners cannot round-trip byte-exactly and are
accepted: a dictionary or properties value holding an integral Real
reparses as Int (the crate serializes 2.0 as 2), and a truncated
source whose declared length exceeds the actual data yields an op whose
dictionary promises more bytes than data holds.
Functions§
- serialize_
ops - Serializes a sequence of content operators: operands space-separated,
one space before each operator keyword, a newline after it.
Inline-image dictionaries are written with their canonical
(unabbreviated) keys, which the parser passes through unchanged.
Infallible: a stream inside a
DP/BDCproperties value — impossible in parser-produced ops — is emitted asnull.