2 Replies Latest reply on Jan 20, 2015 3:11 AM by Tim. Signore

    Retrieve content of text box

    Tim. Signore Level 1

      Hello,

      I am trying to automate a complex PDFing process. A single indesign document needs to be output as several specifically named PDFs, that go into a number of folders that also have specific names. If I place the PDF and folder names in text boxes on the pasteboard of the indesign pages can they be retrieved by a script. Would I need to tag the text box, so that the script knows where to look, and how is this done?

      Many thanks for any help.

        • 1. Re: Retrieve content of text box
          Chinnadk Level 4

          Hi,

           

          Create a layer and name it as 'printpdf', create a text frame with this layer on each page and fill the contents as shown in the image, first line for folder name and the second line for filaname. The text frame should be placed inside the page not the pasteboard.

           

          var doc = app.activeDocument;
          var pages = doc.pages;
          var _layer = doc.layers.item("printpdf");
          _layer.printable = false;
          for(var i =0;i<pages.length;i++)
          {
                  var txfms = pages[i].textFrames;
                  var foldername = "", filename = "";
                  for(var j =0;j<txfms.length;j++)
                  {
                          if(txfms[j].itemLayer.name == "printpdf")
                          {
                                  foldername += txfms[j].lines[0].contents;
                                  filename += txfms[j].lines[1].contents;
                              }
                      }
                  var folder = new Folder(doc.fullName.toString().replace(doc.name,foldername.replace(/.$/,""))).create();
                  app.pdfExportPreferences.pageRange = pages[i].name;
                  doc.exportFile(ExportFormat.PDF_TYPE,File(doc.fullName.toString().replace(doc.name,foldername.replace(/.$/,""))+ "/" + filename+".pdf"),false,)
              }
          

           

          print.JPG

          Regards,

          Chinna

          • 2. Re: Retrieve content of text box
            Tim. Signore Level 1

            THat's great - thanks Chinnadk. I'm just wondering, is it possible to just look for text frames on the 'printpdf' layer, rather than looping through all the text frames and then checking if they belong to that layer.

             

            ALso, as each PDF exported will consist of a range of pages the text box doesn't need to appear on every page. Is it possible to return the pages on which it appears. Just so I understand, does the script think of the pages as a continuous array from zero up, irrespective of how they are numbered and sectioned?

             

            MAny thanks for your help,

            TIm