PDF Viewer - Adjust quality for JPG images
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.
- Initialize the object of PdfViewOptions;
- Set setJpgQuality(…) value;
- Pass PdfViewOptions object to view(…) method.
The following code sample shows how to adjust JPG image quality in the output PDF document.
Viewer viewer = new Viewer("sample.docx"); PdfViewOptions viewOptions = new PdfViewOptions(); viewOptions.setJpgQuality((byte) 50); viewer.view(viewOptions); viewer.close();
Advanced Usage Topics
To learn more about document viewing features, please refer to the advanced usage section.
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Viewer for Java examples, plugins, and showcase
- Document Viewer for .NET App WebForms UI Modern Example
- Document Viewer for Java App Dropwizard UI Modern Example
- Document Viewer for Java Spring UI Example
- GroupDocs.Viewer for .NET samples, plugins and showcase
- Document Viewer for .NET MVC UI Example
Free Online App
Along with full-featured Java library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.