THotPDF.CompressLoadedDocument

THotPDF

 

Top  Previous  Next

Compresses eligible unfiltered streams in a loaded PDF with FlateDecode

 

Delphi syntax:

function CompressLoadedDocument: Integer;

 

Description

Returns the number of streams whose compressed payload was adopted

Uses CompressionLevel to select fastest, default, or maximum zlib compression; clNone leaves the document unchanged

Processes each source stream in bounded chunks and replaces it only when the compressed payload is smaller

Streams that already have a /Filter, deleted streams, and empty streams are left untouched

This compatibility helper delegates to OptimizeLoadedStreams with only lsffUnfiltered selected and a one-byte savings threshold

Call SaveLoadedDocument after compression to write the transformed object graph

 

See also: THotPDF, OptimizeLoadedStreams