Hi, We are evaluating the GroupDocs.Viewer. We generate our own docx files and require high quality line drawing rendering for our graphs. The image quality rendered in the demo project on github of one of our docx files does not meet our requirements. What are the possible resolutions for this? I have uploaded a test.docx that demonstrates this problem. Thank you.
test.docx (7.3 KB)
Hi John,
I’ve investigated the reported issue by loading the attached test.docx (7.3 KB) to the Viewer instance and rendering it to all 4 supported output formats: HTML, PDF, PNG, and JPEG.
Unfortunately I was not able to reproduce the reported image quality issues in any of output files. I’m attaching all these output files here, in 7z archive “Output.7z”, link is right below.
Output.7z (738.0 KB)
If the reported issues are actually present in these files, please point me exactly what and where is wrong. If not present - please provide a code sample so I can reproduce it on my side.
Thanks and waiting for your reply.
With best regards,
Denis Gvardionov
Thanks, yes I was about to respond because I found the pdf rendered file is perfect. The problem is in the rendered raster images, png and jpeg. I don’t actually care if the raster images are not good we don’t have need for them. But, I can’t find a way to get the WPF viewer to render the pdf output. It seems to only render the raster images. We need the viewer to look good.
Am I correct that from your point of view the issue with produced JPEG and PNG raster images is that their resolution (size in pixels) is too low for your demands? Or there is something else wrong with them? If yes, please show on screenshot.
Waiting for your reply.
With best regards,
Denis Gvardionov
Yes, it is that the resolution is too low. You can see it in the test-page2 files you sent my. The png is slightly better than the jpeg, but still not good compared to the docx and pdf renderings.
Hi John,
At this moment the GroupDocs.Viewer renders the DOCX to PNG with max possible quality, available for the original resolution for this particular sample “test.docx” document - 816 x 1056 pixels, which is 96 dots per inch horizontal and vertical resolution. Regarding JPEG — the default quality is 90%, it is controlled by the JpgViewOptions.Quality property, and its max value is 100. So if you want to get the 100% quality for the JPEG output format, you should use something like this:
JpgViewOptions jpegOpt = new JpgViewOptions();
jpegOpt.Quality = 100;
Viewer viewer = new Viewer("test.docx");
viewer.View(jpegOpt);
viewer.Dispose();
However, I’ve made experiments on my side and found that increasing the value up to 100 will have no visual effect.
The only way to improve the raster image quality is to increase the resolution, which is locked to 96 DPI. Now GroupDocs.Viewer does not provide a public option for this despite can do it internally during DOCX rasterization. If such possibility is 100% required for your needs I can open it for public API in the next GroupDocs.Viewer release, so you will be able to manually set the desired horizontal and vertical resolution in public options.
However keep in mind that increasing the resolution will significantly increase pixel dimensions and also a byte size of the file. I’m attaching an archive with 2 JPEG files, which were generated from input “test.docx” with 192DPI - take into account their pixel and especially a byte size. If this is acceptable for your scenario, let me know.
192DPI.7z (353.7 KB)
Waiting for your reply.
With best regards,
Denis Gvardionov
Hi Denis,
Increasing the resolution of the entire file is probably not a good idea as these reports can get quite long. I don’t suppose there is away to anti-alias the rendering of an emf vector file, which is what this image originally is.
John
Understood.
Just want to mention that with the overload of the Viewer.View() method you can render only specific set of pages with specific rendering options. For example, render pages 1-3 with default options (and 96 DPI), and page 4 with adjusted options (and higher DPI). So, if you know, for example, that the is some important content, that should be rendered with good quality, is located on 4th page, you can render this particular page separately from others and with separate options.
But, if the proposed increasing of resolution is not acceptable for your case, I’m afraid we cannot do more within the 96 DPI limit.
With best regards,
Denis Gvardionov