|
Compression Overview
Overview
HotPDF uses several compression and decompression paths depending on whether it is
generating new PDF content or reading existing streams and images from external files.
Main Compression Paths
- FlateDecode: Used for generated PDF streams through THotPDF.Compression and backed by zlib-ng in zlib-compatible mode, with 64-bit runtime SIMD dispatch where available
- LZWDecode: Supported for legacy PDF and TIFF-style data through HPDFLZW.pas
- DCT/JPEG: Used for standard JPEG image workflows handled by HotPDF image support and backed by libjpeg-turbo 3.1.90 with NASM SIMD acceleration objects
- JBIG2 and JPEG2000: Available for specialized image workflows where the source format already uses those codecs
PDF 1.5+ structural size reduction
For PDF 1.5+ output HotPDF can layer two additional structural compression paths on top of FlateDecode-compressed streams. Both are opt-in and pair naturally:
- UseXRefStream: Replace the textual
xref ... trailer cross-reference table with a compressed /Type /XRef stream (ISO 32000-1 7.5.8). Cuts xref overhead by 4-10x on large documents.
- UseObjectStreams: Pack small indirect dictionaries (multi-page documents, annotations, AcroForm widgets, structure-tree elements, Optional Content layers) into
/Type /ObjStm container streams (ISO 32000-1 7.5.7) referenced through type-2 xref entries. Requires UseXRefStream to also be on. A 30-page graphics-only smoke shrinks from 14502 to 8488 bytes (-41.5%) with the two toggles combined.
Related Units
- HPDFZLib.pas for FlateDecode and predictor-aware inflate helpers
- HPDFLZW.pas for LZW decompression
- HPDFJBIG2.pas for JBIG2 decoding support
- HPDFJpeg2000.pas and HPDFOpenJpeg.pas for JPEG2000-related workflows
See Also
|