THotPDF.Compression Property

 

THotPDF.Compression

THotPDF

 

Top  Previous  Next

Determines the PDF file compression.

 

type

THPDFCompressionMethod = (cmNone, cmFlateDecode);

 

Delphi syntax:

property Compression: THPDFCompressionMethod;

 

C++ syntax:

__property THPDFCompressionMethod Compression;

 

Description

Use Compression to get or set the PDF file compression. Compression is one of the following values:

 

Value                Meaning


cmNone                PDF file not compressed.

cmFlateDecode        PDF file encoded using the deflate compression method.

 

Stacking further size reductions

Compression controls FlateDecode encoding of page content / font / image streams, and also selects the Flate effort used for structural containers: the cross-reference stream emitted by UseXRefStream and the /Type /ObjStm containers emitted by UseObjectStreams (ISO 32000-1 7.5.7). UseXRefStream replaces the textual cross-reference table with a compressed /Type /XRef stream whose payload is PNG-Up-predicted (/Predictor 12) and whose free-list holes collapse into /Index subsections. Real-world multi-page documents typically gain another 20-40% size reduction on top of FlateDecode-compressed streams

To switch the whole lot on for a single document, font subsetting included, set CompressDocument

 

Code Example

HPDF := THotPDF.Create( nil );
try
  HPDF.FileName := 'c:\Output.pdf';
  HPDF.BeginDoc;                     // Start PDF document creation
  HPDF.CurrentPage.TextOut( 100, 100, 0, 'Hello World!' );
  HPDF.EndDoc;                       // Finish and save PDF document
finally
  HPDF.Free;
end;