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 JpgQuality setting of PdfViewOptions class. The supported values range of JpgQuality 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 PdfViewOptions.JpgQuality value;
- Pass PdfViewOptions object to View function.
The following code sample shows how to adjust JPG image quality in the output PDF document.
using (Viewer viewer = new Viewer("sample.docx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.JpgQuality = 50;
viewer.View(viewOptions);
}
More resources
Advanced Usage Topics
To learn more about document viewing features, please refer to the advanced usage section.
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Viewer for .NET examples, plugins, and showcase
- GroupDocs.Viewer for Java examples, plugins, and showcase
- Document Viewer for .NET MVC UI Example
- 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
Free Online App
Along with full-featured .NET 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.