- Compress a file:
zlib-flate -compress < path/to/input_file > path/to/compressed.zlib
- Uncompress a file:
zlib-flate -uncompress < path/to/compressed.zlib > path/to/output_file
- Compress a file with a specified compression level. 0=Fastest (Worst), 9=Slowest (Best):
zlib-flate -compress=compression_level < path/to/input_file > path/to/compressed.zlib
zlib-flate -compress | -uncompress
The zlib-flate program is part of the qpdf package.
The zlib-flate program reads from standard input and writes to standard output either compressing or uncompressing its input using raw zlib compression. It can be used to uncompress or compress raw PDF streams or other data that is compressed with raw zlib compression. This program is provided primarily as a debugging tool, though it could be used for other purposes, such as being called from a script that creates simple PDF files.
This program should not be used as a general purpose compression tool. Use something like gzip(1) instead.
For details about qpdf, please see the qpdf manual, which can be found at https://qpdf.readthedocs.io.