2 Replies Latest reply on Apr 23, 2017 10:31 AM by Dwie Kropki

    Document.asynchronousExportFile - can't close document after export

    Dwie Kropki

      I have this function:


      function __exportPdf(doc, file, preset){
          pdfPreset = app.pdfExportPresets.item(preset);        
          // doc.exportFile(ExportFormat.pdfType, file, false, pdfPreset);
          // doc.close(SaveOptions.no);
          doc.asynchronousExportFile(ExportFormat.pdfType, file, false, pdfPreset);



      and this one:

      function __makeListener(_d){
          var afterExportListener = _d.eventListeners.itemByName("afterExport");
          if (afterExportListener.isValid) {
          _d.addEventListener("afterExport", function(event) {
              // event parent is document to close
          }).name = "afterExport";


      alert fires, but document is still open.


      I have a lot of indd files, large and little ones, and i want to open another one when previous one is being exported.
      And it works. But I can't close document of file already exported.