PdfContentWriter class

Reserializes a list of operators back into content stream bytes.

What is preserved

Literals are re-emitted from the original lexeme when there is one (numbers with the same notation, names with the same #xx escapes, strings with the same escapes and delimiters), and the bytes of an inline image come out identical to the input.

What changes

The spacing between tokens is normalized: one space between operands and one line break after every operator. So the output is not byte-for-byte equal to the input for an arbitrary stream — the guarantee that holds is equivalence: reparsing the output produces the same list of operators. Comments only survive if the parser was created with keepComments: true.

Constructors

PdfContentWriter({int lineBreak = 0x0A})
Creates a writer.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
lineBreak → int
Byte used to separate operators (\n by default).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
serialize(List<PdfContentOperator> operators) → Uint8List
Serializes operators into bytes.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

escapeName(String name) → String
Applies the #xx escapes required in a PDF name.
formatNumber(double value) → String
Formats a number the PDF way: no exponent, no unnecessary trailing zeros, and no .0 for integers.
write(List<PdfContentOperator> operators) → Uint8List
Serializes operators into bytes.