 |
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.Universal (in SelectPdf.Universal.dll) Version: 26.5
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")):
at Normal and Best Save(Stream) compresses every stream the file
stored uncompressed; Best also rewrites the page content streams more compactly and
strips unused font data, which takes noticeably longer on large documents.
NoCompression leaves the streams as the file stored them.
- 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