Expand description
COS object serialization: Object values to PDF syntax bytes
(ISO 32000 §7.3). Output is deterministic — dictionary keys are emitted
in sorted order regardless of insertion order.
Streams are deliberately absent here: a stream is only legal as an
indirect object and its /Length bookkeeping belongs to the
Writer, so a nested Object::Stream is an error.
Functions§
- serialize_
dict - Serializes a dictionary with
<< … >>delimiters, keys sorted bytewise for deterministic output. - serialize_
object - Serializes any non-stream object into
out. - write_
name - Writes a name object with its leading solidus, escaping every byte
outside the regular range as
#xx(delimiters, whitespace,#itself, and anything outside0x21..=0x7E). - write_
real - Writes a real number in plain decimal: no exponent, trailing zeros
trimmed,
-0normalized to0, non-finite values written as0. Whole values write as integers (72not72.0). - write_
real_ f32 - Like
write_real, forf32values (content-stream operands): the shortest decimal that parses back to the identicalf32. - write_
string - Writes a string object. Byte content that is printable ASCII (plus tab,
newline and carriage return) uses the literal form with
\-escapes; anything else uses the hex form. The choice is a pure function of the bytes, keeping output deterministic.