Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed May 27, 2020 6:23 pm

I am using spire.PdfViewer for a WinForms project. At one point in the app I open an encrypted pdf:

Code: Select all
spirePdfViewer.LoadFromFile(path, password);


This generally takes around 5 seconds. I would like to have a PictureBox with a loading animation (gif), but the pdfViewer manipulates a Form Control somewhere.

If I load the pdf in a Task or Thread it throws an InvalidOperationException due to spirePdf accessing the control from a thread other than the main UI thread. If I load the pdf in the main UI thread the picture box obviously can’t animate while the load method is running.

Additionally, once loadPdf return there is another 5 second delay before the pdf is actually visible, and the UI is locked during this additional time as well.

Any thoughts on how to resolve this?

Thanks.

my_user_name
 
Posts: 1
Joined: Wed May 27, 2020 6:12 pm

Thu May 28, 2020 6:56 am

Hello,

Thank you for contacting.
Yes, our Spire.PDFViewer is a control and at present its internal processing mechanism is converting PDF pages to images firstly and then view the images. Do you mean that your PDF includes animation (gif), if so, sorry that the animation will not keep. As for the "InvalidOperationException" and the cost time you mentioned, to help look into them accurately, could you please share us with your runnable application as well as your input PDF file for reference. You could upload here or send to us via email([email protected]). Thanks in advance.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1535
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF

cron