Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


adobe acrobat javascript check to see if a file is open

Explorer ,
Nov 13, 2018 Nov 13, 2018

Copy link to clipboard

Copied

Just need to find out how to check if a file is open using JavaScript:

I have this but it doesn't work

    if (myFile.open) <----This is where I need to check if a file is opened. 

   {

   openDoc.insertPages({cPath : p}); 

   }

   else

   {

   var openDoc = app.openDoc(mFile);

   openDoc.insertPages({cPath : p});

   } 

}

THanks.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

299

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 13, 2018 Nov 13, 2018

Copy link to clipboard

Copied

Any file? A specific file?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 13, 2018 Nov 13, 2018

Copy link to clipboard

Copied

LATEST

All of the PDF files open in Acrobat are in the app.activeDocs array. However, this data is only available in a trusted context. Meaning that it can't be accessed from a document script. Here are a couple of articles on the topic:

Trust and Privilege in Acrobat Scripts

https://acrobatusers.com/tutorials/using_trusted_functions

To determine if your document is open you have to know something about it so you can test it, such as the file name and path. But you could use any unique property available from the doc object.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines