Close an open PDF file

Posted on 2004-11-02
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
    LVL 4

    Expert Comment

    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

    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
    LVL 8

    Expert Comment

    LVL 27

    Expert Comment

    Are you using a Acrobat reader?

    Author Comment

    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

    Closed, 300 points refunded.

    Community Support Moderator
    Experts Exchange

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now