API referenceCore SDK

pdfGetCompressionLevel

Set/get the Flate/zlib compression level (0..9) used

C
int32_t __stdcall pdfGetCompressionLevel(PPDF IPDF);
BOOL32 __stdcall pdfSetCompressionLevel(PPDF IPDF, int32_t CompressLevel);
Delphi
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.

ParameterDescription
IPDFDocument handle.
CompressLevel0 = 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)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfGetCompressionLevel(IntPtr IPDF);
Area
Core SDK
Category

Getters

Exported names

pdfGetCompressionLevel

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.