Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

adobe acrobat javascript check to see if a file is open

Explorer ,
Nov 13, 2018 Nov 13, 2018

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
922
Translate
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
Community Expert ,
Nov 13, 2018 Nov 13, 2018

Any file? A specific file?

Translate
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
Community Expert ,
Nov 13, 2018 Nov 13, 2018
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

Translate
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