[Tex/LaTex] Close/open the PDFviewer automatically while compiling


I am using WinEdt 7.0 and my default pdf viewer is FoxitReader. So when I press F9 (compile) in WinEdt, it compiles and shows the pdf automatically. I want to set WinEdt somehow that after some editing of the tex file, when I want to compile and view the pdf I just press the F9 and the editor automatically closes the previous pdf and shows the updated pdf afterwards.

If I try to recompile the file while the viewer is open the output would be:

I can't write on file 'filename.pdf'
please type another file name for output:

Simply I want to open/close the pdf viewer automatically from WinEdt. I think there is a script (something like that) for that (e.g. --single-instance but I couldn't get it to work).

Best Answer

I have to mention that so far there is no solution for conventional PDF viewers such as Adobe Acrobat Reader and Foxit Reader. However, as @Bernard mentioned, by installing SumatraPDF and setting the PDF viewer setting in the WinEdt:

Execution Modes > PDF Viewer > "C:\Users\NKN\Documents\SumatraPDF-3.1.1\SumatraPDF.exe" 

now the system reopens and updates the PDF even if it was already open.

As a final point, although this question was posted in 2014, the problem still remains (in 2017) even with newer versions of WinEdt (9.1/10), Foxit Reader, and Adobe Reader.