@fadip
Hi Frangky,
Thanks for providing the sample project, now things are much more clear for me and I hope in the items below I will answer on all your questions:
1. I’ve investigated and profiled the attached project and I confirm that on my local machine it takes roughly around 35-40 seconds between clicking on filename on the main page and displaying the actual document content.
2. I want to emphasize that in your sample project you’re setting the ImageQuality.High
value for the PdfOptions.ImageQuality
option — you have mentioned it by yourself, but this option was never mentioned earlier in this forum thread, but only the EnableLayeredRendering
. I’ll explain later why this is important.
3. I want to make a step back and describe a clear distinction between the “GroupDocs.Viewer for .NET” and the GroupDocs.Viewer-for-.NET-UI. The first one is a standalone library, a DLL (roughly saying), which has no GUI at all and have only a public API. “GroupDocs.Viewer-for-.NET-UI”, on the other hand, is an open-source project, a demonstration, that provides a web-UI for the “GroupDocs.Viewer for .NET”. Measuring a performance with “GroupDocs.Viewer-for-.NET-UI” is not fully correct, because this project is not intended to be a production-ready solution; it is just a way to show how “GroupDocs.Viewer for .NET” can be used in web applications.
4. In order to address this I’ve developed a pure .NET console application that uses a “GroupDocs.Viewer for .NET” and nothing more, I tried to do it small as possible, it contains only a few lines of code and two methods. What it does - it converts the “INBIPO0001_2024-25.pdf” (already attached inside this project) to the HTML with different combination of options and measures a performance using a Stopwatch
and then writes measured numbers to the console. Here it is:
RenderToHtmlPerformanceSol.7z (336.2 KB)
5. I highly recommend to open and launch this tiny project in Release mode on your machine, but just for the reference here are the results on my machine:
GroupDocs.Viewer, Version=25.8.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'default' options took 5,0587496 secs on iteration #1
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'default' options took 1,6499979 secs on iteration #2
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'default' options took 1,6421109 secs on iteration #3
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'enabled layer rendering only' options took 4,6736339 secs on iteration #1
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'enabled layer rendering only' options took 4,6903255 secs on iteration #2
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'enabled layer rendering only' options took 4,6366784 secs on iteration #3
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'high image quality only' options took 2,3161814 secs on iteration #1
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'high image quality only' options took 2,3078476 secs on iteration #2
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'high image quality only' options took 2,3516725 secs on iteration #3
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'enabled layer rendering and high image quality' options took 24,4529227 secs on iteration #1
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'enabled layer rendering and high image quality' options took 24,7342502 secs on iteration #2
Converting 'INBIPO0001_2024-25__2.pdf' to HTML with 'enabled layer rendering and high image quality' options took 24,6336459 secs on iteration #3
From these numbers we can see the most important thing: when the HtmlViewOptions
are default, or only the PdfOptions.EnableLayeredRendering
flag is enabled, or only the PdfOptions.ImageQuality = ImageQuality.High
is set, the performance is pretty good - from 1.6 to 4.6 seconds. But when the PdfOptions.EnableLayeredRendering = true
and PdfOptions.ImageQuality = ImageQuality.High
are set simultaneously, the performance falls down to the very bottom. It is not the 40 seconds, but still high enough - 24 seconds.
6. So your initial conclusion is fully correct — the specific combination of EnableLayeredRendering
and ImageQuality.High
drops the performance. This is because these options actually are treated as “maximum quality at the cost of minimum performance”. And the advice here is not to use this combination if possible.
7. However, if such demand of max quality is a mandatory for you, I can create an analysis request for our developers, whether they can optimize it. But, of course, you should understand that it is practically impossible to achive the performance for the max quality to be the same as for the min quality.
Thanks and waiting for your reply.
With best regards,
Denis Gvardionov