0 Replies Latest reply on Feb 22, 2013 6:45 AM by BEGINNER_X

    Import Pdf (No User Interface)

    BEGINNER_X Level 3

      Hi All,


      I need a script to import selected pdf in new document.



      I search forum, most of the scripts are done by using user interface or myDialog (i.e., MultiPageImporter2.5-CS5.jsx, PDF Multipage Import.jsx etc...)



      Selected pdf import in 1st page of Indesign files with x axis = 0; y axis = 0



      Trying script is:



      var myFile = File.openDialog("Select the PDF file you want to place","PDF Files (*.pdf):*.pdf");


      if(myFile == null)


          alert("Please select a PDF file and then try again.");





      if(myFile != null)


          //Get the Number Of PdfPages.

          var pdfPages = getNumberOfPdfPages(myFile);





      function getNumberOfPdfPages(pdfFile){


          pdfFile.open("r", "TEXT", "");

          oneLine = pdfFile.readln();

          while (oneLine.indexOf("/N ") < 0){

              oneLine = pdfFile.readln();

              slashN = oneLine.indexOf("/N ");

              nextSlash = oneLine.indexOf("/" , slashN+1);

              pdfP = oneLine.substring(slashN+3 , nextSlash);






      Thanks in advance