4 Replies Latest reply on May 14, 2010 7:37 AM by 2402143

    save in batch (javascript)

    2402143

      We have a batch sequence that contains an execute javascript. It basically reads a specific file (not the selected pdf) to get a list of values, searches the selected pdf for these values, creates a report of found values and saves the report as a new pdf (different filename) in the same directory as the selected pdf.

       

      It works correctly in 1 directory. When I run the batch sequence against a file in a different directory I get an error:

      Processing error: NotAllowedError: Security settings prevent access to this property or method.

      I've determined that the error is occuring when the report save is happening.

       

      It happens whether the save is done in the batch javascript or via a trusted function. The trusted function is located in a .js file in the same directory as the global.js and  global.settings.js.

       

      if the save is in the batch it is as follows:

      var Rfilename = this.path.replace(/\.pdf$/, "_batchcreated.pdf");

      var RDoc = new Report();

      use writeText to add lines of text.

      RDoc.save({ cDIPath: Rfilename});

       

       

       

      if using the trusted function the batch has:

      var Rfilename = this.path.replace(/\.pdf$/, "_batchcreated.pdf");

      var RDoc = new Report();

      use writeText to add lines of text.

      var sdoc = mytrustedSaveDoc(RDoc,Rfilename);

       

      the .js file has:

      var mytrustedSaveDoc = app.trustedFunction( function (mydoc,myfilename)
      {

          app.beginPriv();

          mydoc.save({ cDIPath: myfilename});

          app.endPriv();


      })  // end trusted function