Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Releasing displayed pdf files in webbrowser control

I have a webbrowser control in my winforms application to display a selected pdf file, after this i want to move the pdf file to an other location.

When i trie to move the pdf file it is giving me an error that the file is in use. I tried to make the webbrowser navigate to a other page before it is moved but it still give me this error that the file is used by an other process.

How can i release this pdf file so i can just move it? Disposing the webbrowser didn't do the trick.

like image 450
PandaNL Avatar asked Mar 12 '12 15:03

PandaNL


People also ask

Where PDF files are saved when opened in browser?

They are stored at this path %USERPROFILE%\AppData\Local\ in Windows.

How do I get PDFs to open in Adobe and not my browser?

Right-click the PDF, choose Open With > Choose default program or another app in. 2. Choose Adobe Acrobat Reader DC or Adobe Acrobat DC in the list of programs, and then do one of the following: (Windows 10) Select Always use this app to open .


1 Answers

They say "Adobe Acrobat and Adobe Reader are designed to continue running for a few minutes after you close the browser window in which you viewed PDF files."

The workaround for this seems to be :
Copy the PDF to a temporary file and display it, and then when you navigate away, it doesn't matter if AcroRD32.exe holds onto the PDF for a few minutes because you can still do what you need with the original!

like image 76
AjV Jsy Avatar answered Oct 03 '22 15:10

AjV Jsy