Is this possible with "Process"?

  • Thread starter Thread starter johnb41
  • Start date Start date
J

johnb41

I am using a "Process" to open a .pdf file in Acrobat Reader, like
this:

Dim proc As New Process
With proc.StartInfo
.FileName = "c:\filename.pdf"
.UseShellExecute = True
End With
proc.Start()

When the PDF file is open for viewing, I will eventually need Acrobat
to CLOSE the file, so i can programatically "move" the .pdf file to a
different location on my drive. But I can't because the file is in
use. Currently I have to manually close the .pdf file before moving
it.

Is there a way to have .net automatically close the file in Acrobat?

Thanks for all your help!

John
 
Hi John ! :O)
Is there a way to have .net automatically close the file in Acrobat?

using proc.CloseMainWindow() should close Acrobat (or any designated PDF
viewer) which should release the file ...

The question is, do you need the application to stay open ?
 
Yanick,

Yes, ideally, I would like the app to stay open. So when the user
opens the next PDF file the entire Acrobat doesn't have to reload.

Is that possible? If not, for now I could deal with having the app
close. Not ideal, but maybe better than having to close the file
manually every time...

Thanks!
John
 
johnb41 said:
Yanick,

Yes, ideally, I would like the app to stay open. So when the user
opens the next PDF file the entire Acrobat doesn't have to reload.

Is that possible? If not, for now I could deal with having the app
close. Not ideal, but maybe better than having to close the file
manually every time...

Thanks!
John

Before creating the process, copy the file to the user's temporary folder
and open the temporary copy instead. That way, you can move the file around
and access it all you want :)

Mythran
 
Back
Top