Deflate
Pure-Kotlin RFC 1951 DEFLATE deflater — the inverse of Inflate.
Emits a single final block using the fixed Huffman code tables (BTYPE=01) with greedy LZ77 match finding over a 32 KiB window (hash-chained, bounded chain length). Fixed Huffman avoids the complexity of transmitting dynamic code-length tables while still giving real compression on the repetitive text/operator streams typical of PDF content; dynamic Huffman (BTYPE=10) is a future ratio improvement.
Output is bare DEFLATE; Zlib.encode wraps it for PDF's FlateDecode. The result decodes byte-for-byte through KitePDF's own Inflate (and MuPDF).
Bit-packing matches Inflate's reader: data elements (the block header and the length/distance extra bits) are packed least-significant-bit-first, while Huffman codes are packed most-significant-bit-first.