PdfWriter class

PDF writer — serializes PDF objects back to bytes.

Supports:

  • Writing new PDFs from scratch
  • Serializing modified objects
  • Incremental saves
  • Garbage collection
  • Deflate compression

Constructors

PdfWriter()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addObject(PdfObject obj) PdfRef
Add an indirect object and return its reference.
addObjectWithNum(int objectNumber, int generation, PdfObject obj) → void
Add an object preserving its original object number. Used when rebuilding a PDF to keep cross-references intact.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setTrailer(PdfDict trailer) → void
Set the trailer dictionary.
toString() String
A string representation of this object.
inherited
write({int garbage = 0, bool deflate = true, bool clean = false}) Uint8List
Write the complete PDF to bytes.

Operators

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

Static Methods

createBlankPdf({double width = 595, double height = 842}) Uint8List
Create a minimal valid PDF with one blank page.
createEmptyPdf() Uint8List
Create a minimal valid PDF with no pages.