1 Reply Latest reply on Feb 3, 2013 12:51 AM by try67

    How To app.openDoc & file exists


      I'm creating a pdf named "ABC.pdf"....



      Open ABC.pdf. It include JavaScript

      var otherDoc = app.openDoc("DEF.pdf", this);



      And, if file doesn't exist. false....

      var otherDoc = app.openDoc("GHI.pdf", this);


      I do not understand how to write this divergence order.

      Would you teach who it is?

        • 1. Re: How To app.openDoc & file exists
          try67 MVP & Adobe Community Professional

          It's not that easy... First of all, the files you're trying to open have to be disclosed. Is that the case?

          Also, you can't use openDoc in the Doc Open event of another document, as is specfied in the JS API Reference.

          What you can do, though, is place the code somewhere similar, like in the Page Open action of the first page. Of course, then you'll need to make sure that it doesn't get launched each time someone scrolls to that page.

          openDoc itself can either return null or throw an Exception if the file doesn't exist (or exists but is not not disclosed), so you will need to account for both possibilities.