We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Closing a PDF Document

We have an application where the user needs to preview a PDF file and if it's the correct file then move it to another location (e.g. a NAS).

The problem is (as with Adobe Reader) the file remains open / in use while the viewer is viewing it.
 
We tried calling both  Unload() as well as LoadedDocument.Close() functions but they don't seem to close the file and the Unloaded event doesn't get called until we close the window.

Is there a way to close this PDF file & release the file so we can move it without destroying the control / closing the window each time since we need to move this file then look at the next one.



4 Replies

PE Priyanga Elangovan Syncfusion Team August 10, 2017 01:12 PM UTC

Hi David,

Thank you for contacting syncfusion support.

Yes, it is possible to unload the current loaded document and to view the new PDF document in PdfViewerControl without closing the window each time. We have prepared the sample to meet your requirement. We can unload the loaded PDF document using Unload API of the PdfViewerControl. We have included the code snippet to unload the loaded PDF document in unload button of the sample. You can use the “open” button in the PdfViewerControl to open the new PDF document in PdfViewerControl.

Please find the sample from below link.
http://www.syncfusion.com/downloads/support/forum/132034/ze/UnloadSample11157146785.zip

If our definition of this issue is different from your requirement, then let us know the specific details, so that we can work towards fulfilling your requirement.

Regards,
Priyanga.E
 



DP David Partington August 11, 2017 10:32 AM UTC

Thanks, your sample project was much appreciated and finally helped us to figure out the issue.

Your sample project loaded the PDF in to the viewer in the window loaded event rather than how/when/where we were loading it.  Once we changed to using the window loaded event we were able to delete / move the file once the dialog was closed.

Thanks!

David



AK Ayswarya Krishna Kumar Syncfusion Team August 14, 2017 10:00 AM UTC

Hi David, 
A support incident to track the status of the reported issue has been created under your account. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents 
Regards, 
Ayswarya 



ME Mohamed Emad January 23, 2019 10:43 AM UTC

I'm facing the same issue and tried the Fix sent by but in vain.
I'm having a tool (Windows form) to convert docx to pdf and display the pdf file with Syncfion pdf viewer.
It's working fine the first time but if I tried to convert the same docx file it's throwing
The process cannot access the file 'sample.pdf' because it is being used by another process.
because the pdf file is used by Syncfusion pdf viewer however I've uploaded the file using the Unload API before the second conversion.
Please We need urgent help 

Loader.
Live Chat Icon For mobile
Up arrow icon