1 Reply Latest reply on Feb 20, 2014 11:46 AM by BEGINNER_X

    How do I write a javascript code to open InDesign File, import Doc, save and export to pdf?

    hasvi Level 1

      How do I write a javascript code to open InDesign File, import Doc, save and export to pdf?

        • 1. Re: How do I write a javascript code to open InDesign File, import Doc, save and export to pdf?
          BEGINNER_X Level 3

          Hi hasvi,

           

          Need Template(.indt), textframes etc for the following script:

           

           

          var myFolderInd = Folder.selectDialog();
          
          var myFile = myFolderInd.getFiles("*indt");
          
          app.open(myFile)
          
          var myDoc = app.activeDocument;
          
          var myDocName = myDoc.name;
          
          var mySaveFile = app.activeDocument.save(myFolderInd.fsName + "/" + myDocName.split(".indt").join(".indd"));
          
          var myFolderDoc = Folder.selectDialog();
          var myFile1 = myFolderDoc.getFiles("*doc");
          
          mySaveFile.pages[0].textFrames[0].place(File(myFile1))
          
          //~ mySaveFile.place(File(myFile1))
          
          app.activeDocument.textPreferences.smartTextReflow = true;
          
          var myPDFFile = new File(mySaveFile.filePath + "/" + mySaveFile.name.split(".indd").join(".pdf"))
          
          myDoc.exportFile(ExportFormat.PDF_TYPE, File("~/Desktop/abc.pdf"));
              
          alert("Process Completed")
          

           

          Regards

          Siraj