PdfSaveOptions.ImageCompression

PdfSaveOptions ImageCompression property. Specifies compression type to be used for all images in the document.

PdfSaveOptions.ImageCompression property

Specifies compression type to be used for all images in the document.

public PdfImageCompression ImageCompression { get; set; }

Remarks

Default is Auto.

Using Jpeg lets you control the quality of images in the output document through the JpegQuality property.

Using Jpeg provides the fastest conversion speed when compared to the performance of other compression types, but in this case, there is lossy JPEG compression.

Using Auto lets to control the quality of Jpeg in the output document through the JpegQuality property, but for other formats, raw pixel data is extracted and saved with Flate compression. This case is slower than Jpeg conversion but lossless.

Examples

Shows how to specify image compression in PDF.

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.ImageCompression = PdfImageCompression.Jpeg;
pdfSaveOptions.JpegQuality = 50;

Converter.Create()
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "PdfSaveOptions.ImageCompression.pdf", pdfSaveOptions)
    .Execute();

See Also