Taking Generators Too Far: Writing a PDF from Scratch in Python
recording removed on YouTubehttps://youtu.be/WqdUOt0TRP0
summary
Claim: a small Python PDF writer streaming every byte using generators produces complete PDFs in constant memory; tools actually used include the standard library deflate compressor for zlib streaming, generator return values to report compressed lengths, and itertools-like pairwise sliding windows to insert cing kerning table adjustments. Surprises: forward references and the XREF offset list force tricks (deferred length objects and a tiny final table), and the result works with one modest exception: a small accumulated XREF index.
AI-written summary · about
related talks
26mGenerators, coroutines and nanoservices
25mLazy Looping: The Next Iteration
06mSVG in Custom PDF Templates
25mAsync Iterators: A New Future for Streams
40mScaling Python - Bank Edition
30mExtensible Python: Robustness Through Addition
55mReactive PDF Printing
23mAsync Iterators: a new future for streams