Documentation
¶
Overview ¶
Optimize compares the default writer with the optimized writer (cross-reference streams per ISO 32000-1 §7.5.8 plus object streams per ISO 32000-1 §7.5.7, orphan sweep over §7.5.4 reachability, and Flate recompression of eligible payloads per §7.4.4) across several document shapes and reports the byte-size delta for each.
The compression ratio depends heavily on what the document contains: content streams produced by Folio's writer are already at zlib.BestCompression and cannot benefit from re-deflate, so layout- built documents see most of their gains from object-stream packing and the orphan sweep. Imported documents (built by parsing a source PDF and copying pages into a new Document) carry their content streams in raw plaintext form — that is where recompression wins big.
Usage:
go run ./examples/optimize