5 Answers, 1 is accepted
RadPdfViewer offers an option for unloading documents which may be suitable for your scenario. It is just necessary to call the RadPdfViewer.UnloadDocument method.
However, I would recommend you to have a look at the following help article where it is demonstrated how to show a waiting bar while a large document is being loaded: https://docs.telerik.com/devtools/winforms/controls/pdfviewer/how-to/handle-rendering-events
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Hi Dess,
Thanks for the reply. I'm already unloading the document before each time i'm trying to load another one. There's already a waiting bar (seems out of the box) that is shown but we don't want to prevent the user to try loading something else and stop waiting for the big document to load.
Cheers,
There isn't a suitable public API for aborting the load operation of a document that is currently being loaded in RadPdfViewer. I have tested calling the UnloadDocument method. It seems to instantly unload the document. But if you use the approach for showing a waiting bar while the document is being loaded, please ensure that the waiting bar is stopped before unloading the document:
this
.radPdfViewer1.PdfViewerElement.StopWaiting();
this
.radPdfViewer1.PdfViewerElement.UnloadDocument();
I hope that this approach may be applicable for your scenario.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Hi Dess,
Sorry for the delay. It did not work (asking for many unloaddocument/loaddocument(filepath) result in having the exception File is closed) so I will block the user from asking document to load document until the current one it loaded. The list of file are in a RadGridView. The only problem I got left is that whenever I put the grid to enabled = false, I got the grid color to change to grey. Is there a way to prevent the color change?
Thanks!
When you disable a certain control, it is absolutely normal that it gets gray. This is valid for the standard MS WinForms controls as well.
A possible solution that I can suggest in order avoid such a gray look, is to set the GridViewElement.UseDefaultDisabledPaint property to false and manipulate the GridViewElement.Enabled property instead of setting the Enabled property of RadGridView.
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Progress Telerik