pdfSetCompressionLevel
Set/get the Flate/zlib compression level (0..9) used
int32_t __stdcall pdfGetCompressionLevel(PPDF IPDF);
BOOL32 __stdcall pdfSetCompressionLevel(PPDF IPDF, int32_t CompressLevel);
function pdfGetCompressionLevel(const IPDF: PPDF): Integer; stdcall;
function pdfSetCompressionLevel(const IPDF: PPDF; CompressLevel: Integer): LongBool; stdcall;
Purpose. Set/get the Flate/zlib compression level (0..9) used throughout the serializer for every compressible stream — content streams, ICC profiles, CMap streams, embedded files, thumbnails, patterns, templates, alpha channels, and more.
Description. Verified thoroughly real and widely consumed — grep confirms FCompressionLevel (default 1, an explicit DIFF from the classic API's default) gates a FlateCompress call at more than a dozen distinct serialization sites across essentially every stream-producing code path in the document. <= 0 disables Flate compression entirely at each of those sites (streams are written uncompressed).
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
CompressLevel | 0 = no compression; 1..9 = zlib compression level (higher = smaller/slower). |
Return value. Getter: the current level (default 1); 0 if IPDF invalid. Setter: True if IPDF valid.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Setters
pdfSetCompressionLevel
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.