We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

GroupDocs.Viewer 21.11.1 degrades image quality with HtmlViewOptions

I figure out that between versions GroupDocs.Viewer 21.11 and 21.11.1 that quality of the generated image by the Viewer with HtmlViewOptions decreased. I’m sharing a PDF document and the result files in the attachments.

Original document:
Image generated by 21.11:
Image generated by 21.11.1:

ocr-image-based.pdf (15.6 KB)
gd-21-11_p_1_i.png (21.0 KB)
gd-21-11-1_p_1_i.png (23.5 KB)

@john.mcqueide

In 21.11.1 the algorithm that was using to process images in PDF files has been updated. When rendering PDF files with images the image quality is set to ImageQuality.LOW by default. There are three options you can select between:

  • ImageQuality.LOW
  • ImageQuality.MEDIUM
  • ImageQuality.HIGH

Here is pdf-image-quality-comparison.png (175.4 KB).

This sample-app.zip (236.4 KB) was used to generate all three output HTML files with the following code:

 try (Viewer viewer = new Viewer("ocr-image-based.pdf")) {
     //ImageQuality.LOW (Default) | ImageQuality.MEDIUM | ImageQuality.HIGH
 
     HtmlViewOptions low = HtmlViewOptions.forEmbeddedResources("low.html");
     low.getPdfOptions().setImageQuality(ImageQuality.LOW); 
 
     HtmlViewOptions medium = HtmlViewOptions.forEmbeddedResources("medium.html");
     medium.getPdfOptions().setImageQuality(ImageQuality.MEDIUM); 
 
     HtmlViewOptions high = HtmlViewOptions.forEmbeddedResources("high.html");
     high.getPdfOptions().setImageQuality(ImageQuality.HIGH); 
 
     viewer.view(low);
     viewer.view(medium);
     viewer.view(high);
 }

Please let us know if it works for you.

Yes, thanks for your help.

1 Like

@john.mcqueide

You’re welcome!