Closing already opened document while opening another document
Hello,
I have created a plugin which I can access from my external program.
Plugin adds a menu item to the acrobat.
Open document is one of the function of my plugin.
Workflow 1:
1. My external IAC program passes the document path to plugin and hits the menu item.
2. Now, plugin opens the document from the received path.
Workflow 2:
Now, I navigated to my external program. This time, acrobat windows has been minimized.
Again if my external program hits the menu item with different document path this time, it does not close the previous document.
To overcome this behavior, I used AVDocClose(avDoc, false) method.
But it seems it only works when Acrobat window is NOT minimized.
How can I achieve my goal?
My code snippet:
ACCB1 void ACCB2 OpenDocument()
{
AVDoc avDoc = AVAppGetActiveDoc();
PDDoc pdDoc = AVDocGetPDDoc(avDoc);
AVDocClose(avDoc, false);
char filePath[256];
GetPrivateProfileString("OpenFile", "filePath", "", filePath, 256, iniFilePath);
ASAtom pathType = ASAtomFromString("Cstring");
//Create an ASText object
ASText titleText = ASTextNew();
ASTextSetPDText(titleText, "This PDF was opened by using the Acrobat SDK");
//Create an ASPathName object
ASFileSys fileSys = ASGetDefaultFileSysForPath(pathType, filePath);
ASPathName pathName = ASFileSysCreatePathName(fileSys, pathType, filePath, NULL);
//Open the PDF file
AVDoc myDoc = AVDocOpenFromFile(pathName, fileSys,NULL);
//Do some clean up
ASFileSysReleasePath(fileSys, pathName);
ASTextDestroy(titleText);
}
Many Thanks!
