Set Jpeg images quality

When rendering documents to PDF format that contains JPG images it may be reasonable to reduce size of the output file by adjusting quality of the JPG images. GroupDocs.Viewer enables you to adjust quality of images in the output PDF document with setJpgQuality() setting of PdfViewOptions class. The supported values range of setJpgQuality() is from 1 to 100. Default value is 90.

The following steps are to be followed in order to set image quality.

The following code sample shows how to adjust JPG image quality in the output PDF document.

try (Viewer viewer = new Viewer("sample.docx")) {
    PdfViewOptions viewOptions = new PdfViewOptions();
    viewOptions.setJpgQuality((byte) 50);
    viewer.view(viewOptions);
}