Slow viewer- page hangs

I loaded a 200 page pdf file that is 3mb in size.

It takes almost a minute to load the first page of the file.
Changing a single page using the next buttons takes about 5-10 seconds and hangs the application until the next page is shown.
Clicking any other button like zoom etc, takes a long time and hangs the application.
The cache folder creates 200 individual jpg file that are 150mb total in size!!! Why is that?

Hello Nicolasi,


Thank your for the request. By default, when you open a web-page with GroupDocs.Viewer widget, and the target document is invoked (for displaying), on the server-side GroupDocs.Viewer converts the document to the images and text (for the image-based rendering) or to the HTML, images, fonts, and CSS (for the HTML-based rendering). Only when this conversion process is finished, GroupDocs.Viewer begins to transmit data to the client-side and end-user can see content of the document in the browser. That’s why it takes so much time - GroupDocs.Viewer needs to convert all document, and they are really big. The conversion speed depends on the performance of the server - CPU, memory, storage.

However, there is a “PreloadPagesCount” method. When using it, for example, “.PreloadPagesCount(1)”, GroupDocs.Viewer begins to transmit data to the client-side when only first page of the document is converted. After applying this method to the 1st document (17 MiB), GroupDocs.Viewer shows its first page almost instantly. All other pages are shown on demand, when you try to open them.

There are some other methods to increase performance:
1. Use “PreloadPagesCount(1)” method. When using this method GroupDocs.Viewer will begin to load document to the client-side when first page of the document will be converted. When this method is not used, GroupDocs.Viewer converts all pages of a document and only then sends it to the client-side.
2. Use “MinimumImageWidth(value)” method. MinimumImageWidth: if set, the Viewer will load page images with the specified width from the server when starting. It will not load page images from the server again after zooming if the current page image size is smaller than the value specified and if the original (not scaled) page image size is smaller than the value specified. It means that in most cases the GroupDocs.Viewer will load page images only once and will not reload them after zooming in/out.
3. If this is possible for your business-logic, disable thumbnails (“ShowThumbnails(false)”).
4. If this is possible for your business-logic, disable ability to select text by using “SupportTextSelection(false)” method.
5. Use “ShowViewerStyleControl(false)” method - it will disable “double page flip” option and will increase performance.

Best regards.

What about the size? The initial pdf size is about 3mb and the client downloads a lot more than that. In the processing and cache folders, for just the 60 first pages it genereted images of 45mb in each folder. Client downloaded more than 10mb.

Can the files be in the png format instead of jpg?

Hello Nicolasi,


Thank you for coming back. Please to use such option: .UseHtmlBasedEngine(true, true)

Best regards.

the ui does not get stuck any more and the size reduces but now there are 81 requests per page!!!


Hello,


Thank you for coming back. Could you please share with us example of the document?

Thank you.

Please find attached.

Hello,


Thank you for the document example. Yes, this behavior is normal and the document rendered well. By default, when you open a web-page with GroupDocs.Viewer widget, and the target document is invoked (for displaying), on the server-side GroupDocs.Viewer converts the document to the images and text (for the image-based rendering) or to the HTML, images, fonts, and CSS (for the HTML-based rendering) - since that it makes so much requests to load all data of the document.

Best regards.

Yes the document is rendered ok but 80 requests per page are a lot.

There will be 5000 users using the viewer, so let’s say 1000 of them decide to view a document, that is 80,000 requests, per page!

Hello,


Thank you for coming back. This is a Viewer feature and it works in such way. Sorry but we can’t reduce number of requests.

Sorry for the inconvenience.

Is there an option to process the pdf files in memory instead of disk?

Hello Nicolasi,


Thank for your request. Yes, it’s possible. To achieve that you have three variants:

1. Use Amazon or another cloud storage - for how to’s please check ViewingViaProvider example
2. Use custom storage provider class which will override default storage provider - the same example (ViewingViaProvider )
3. If you use WinForms project - here this feature is available from the box, for more info please check this documentation

Best reagrds