Click or drag to resize
Pdf Library for .NET

PdfDocumentJpegCompressionEnabled Property

Gets or sets a flag indicating if JPEG compression is applied to the images in the generated pdf document. Default is true.

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public bool JpegCompressionEnabled { get; set; }

Property Value

Boolean
Remarks
How the compression is applied depends on how the document was produced:
  • Images added via PdfImageElement on a document built from code: the image is pre-compressed as JPEG (when opaque and large enough) at the moment it is added to a page. Transparent images (alpha channel) and small images (under 100×100 pixels or 4 KB) are kept as PNG to preserve fidelity.
  • Documents produced by HtmlToPdf: the Chromium-rendered bytes are compressed once during conversion, using JpegCompressionEnabled / JpegCompressionLevel. The values are reflected onto this property for inspection; changing them on the output document has no effect.
  • Documents loaded from an existing PDF: Save(Stream) applies image compression while the document is written.
Encrypted loaded documents skip image compression.
See Also