Close an open PDF file

Posted on 2004-11-02
Medium Priority
Last Modified: 2010-04-23
Hi Experts,
  Hopefully someone has run into this one before.  I have a VB.NET process that sometimes requires an existing PDF to be deleted.  Several files may be open at one time.  For example, say I have File1.pdf, File2.pdf, and File3.pdf all open.  During execution of my application, I get to a point where File3.pdf needs to be deleted.  If I try to do this while it's open, it obviously will error.  My question:  How do I check to see if File3.pdf is open and, if it is, how to I close it?

Thanks Experts!
Question by:Ren

Expert Comment

ID: 12479302
I think you could cycle through all the open windows and close the one appropriate to the file that you want. This however would be dependant on Acrobat having something in the windows titlebar that is recognisable.

I am going to dig through some old code to see what I can find.

LVL 18

Expert Comment

ID: 12480707
Try deleting it. if you are unable to delete and get an access exception, then it means it is open.
Now if you are sure that it is open in Adobe Accrobat, do something like in this post to get the process and send the Close keys like Alt- F4
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 27

Expert Comment

ID: 12483884
Are you using a Acrobat reader?

Author Comment

ID: 12524931
Since I can tell if it is open or not, I think I will just ask the user to close the open pdf file.  That way, if they had it open to make changes, they will have the opportunity to save it as a different name or whatever they would like to do.

Thanks for the suggestions.

Accepted Solution

modulo earned 0 total points
ID: 12574164
Closed, 300 points refunded.

Community Support Moderator
Experts Exchange

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question