Advertisement

01.05.2008 at 02:13PM PST, ID: 23061255
[x]
Attachment Details

Correct method for opening and closing Acrobat by API

Asked by qz8dsw in Visual Studio .NET 2005, Adobe Acrobat

Tags: Adobe, Acrobat, 8.1.1, VB.NET

Hi all,

I'm using VB.net 2005 to talk to Adobe via it's COM interface.
Everything seems to be working fine until it comes to the time to close adobe Acrobat
It false to app.close()
Executing the app.exit() or the App.MenuItemExecute("Quit") does not close adobe acrobat (still running as a task in task manager).

The only thing I can think of is there is still something I've not closed which means adobe can't close (Or I'm doing it in the wrong order).
I've tried this with adobe hidden and visible and although the adobe window disappears, the acrobat.exe process still continues to stay in background.
The reason I'm wanting to close it completely is I've found it helps with memory when opening up multiple pdf's via COM.

Thanks for any help in advance,
Terry
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
' open Adobe
                    oApp = CreateObject("AcroExch.App")
                    ' hide it
                    oApp.Hide()
                    ' re-open the file and get the pointers in place again
                    oAvDoc = CreateObject("AcroExch.AVDoc")
                    oAvDoc.Open(inFile, "")
                    oDoc = CreateObject("AcroExch.PDDoc")
                    'create the 2 adobe "documents" we will be using
                    oDoc = oAvDoc.GetPDDoc()
                    oJS = oDoc.GetJSObject()
..... rest of code in here for doing stuff with the PDF
 
                    oJS = Nothing
                    bRetCode = oDoc.Close()  
                    oDoc = Nothing
                    oAvDoc.Close(1)
                    oAvDoc = Nothing
                    bRetCode = oApp.CloseAllDocs() ' returns true
                    bRetCode = oApp.Exit()  ' returns false
                    bRetCode = oApp.MenuItemExecute("Quit") ' returns true
                    oApp = Nothing
[+][-]01.05.2008 at 06:10PM PST, ID: 20592208

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.05.2008 at 07:05PM PST, ID: 20592323

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.10.2008 at 07:14PM PST, ID: 20633821

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2005, Adobe Acrobat
Tags: Adobe, Acrobat, 8.1.1, VB.NET
Sign Up Now!
Solution Provided By: qz8dsw
Participating Experts: 2
Solution Grade: B
 
 
[+][-]01.11.2008 at 04:48AM PST, ID: 20635781

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628