I am opening a PDF file using Process myProcess = Process.Start(fileLocation);
. I need to close this PDF file before opening a new file. Otherwise I will end up with hundreds of instances open on my default PDF reader.
I attempted to use myProcess.CloseMainWindow();
but I got an error that the window had already closed. I think myProcess
works by creating a secondary Process that displays the pdf. I have no information about this potential secondary process.
I am currently using MicrosoftEdge as my default pdf application and coding in Microsoft Framework 4.8.