 |
PdfDocumentCompressionLevel Property |
Gets or sets the Flate/DEFLATE compression level applied to content streams, fonts,
and non-image objects in the PDF. Complements
JpegCompressionEnabled,
which handles image XObjects. Default is
Normal.
Namespace: SelectPdf.UniversalAssembly: SelectPdf.HtmlToPdf.Universal (in SelectPdf.HtmlToPdf.Universal.dll) Version: 26.4
Syntaxpublic PdfCompressionLevel CompressionLevel { get; set; }Public Property CompressionLevel As PdfCompressionLevel
Get
Set
Property Value
PdfCompressionLevel
Remarks
Behavior depends on how the document was produced:
- New documents (new PdfDocument()): the value drives the
DEFLATE level applied at serialization time. Best uses a higher DEFLATE level
(slower to produce, smaller output); Normal is the default speed/size balance;
NoCompression writes plain streams.
- Loaded documents (new PdfDocument("file.pdf")):
Save(Stream) enables page-content optimization at Normal and Best,
plus font optimization at Best — Normal and Best therefore differ only in
whether unused font data is stripped.
- HtmlToPdf output: the value set on
PdfCompressionLevel is applied during conversion
and reflected here for inspection. Setting this property after conversion is a
no-op — change PdfCompressionLevel before conversion instead.
Encrypted loaded documents skip the compression pass entirely.
See Also