3 Replies Latest reply on Mar 16, 2014 3:26 AM by Kasyan Servetsky

    Bridge Talk to Save Masked Document as Web PNG


      Hi everyone,


      I'll start off by saying that I am by no definition an experienced programmer, however I have been able to hack together a few scripts to help eliminate some repetitive tasks from my workflow (using CS 5.5). One of these tasks requires me to save a web-ready png thumbnail of an indesign file that is clipped to a specific die line path. In the past, how I've manually done this is to group all objects in the document and paste them into the die line object so that it masks the outside areas. I would then export this as a pdf, import it into photoshop, resize it to my necessary diminsions (167px wide), and save it as a web ready transparent PNG.


      In an attempt to automate this lengthy process, I've been able to create this script which I've included below, that groups all objects in the document and pastes them into the currently selected die line object, and then exports the document as a PDF. From this point on however I'm still stuck with having to open that PDF in photoshop manually, resize it, and save a transparent PNG back to the same folder.


      I know that you can have Indesign give commands to Photoshop using Bridge Talk, but I'm unsure of the best way to try to achieve my goal. Is it possible to use scripting to export a pdf, and then use bridgetalk to open that same pdf in photoshop for processing? Or would I be better off just doing the Photoshop part manually as I have been?


      Here is my Export Masked PDF script:


       if (app.activeDocument.selection.length > 0) {
      var myDocument = app.activeDocument;
      var myDieline = app.selection[0];
      //select all objects
      //group all objects except die line
      myDieline.visible = false;
      var myObj = new Array;
      myObj = app.selection;
      var myGroup = app.selection[0];
      myDieline.visible = true;
      //cut group and paste into die line
      //define pdf export preferences and save PDF
      var preset = null;
          useDocumentBleedWithPDF = false;
          includeSlugWithPDF = false;
          cropMarks = false;
          bleedMarks = false;
          pageInformationMarks = false;
          registrationMarks = false;
          colorBars = false;
      if (myDocument.saved) preset = myDocument.filePath;
      var f = Folder.selectDialog('Choose a folder',preset);
      for (var count = 0; count < myDocument.pages.length;count++)
          if (f != null)
              var file = File(f+'/'+String(myDocument.name).replace(/.indd$/,'-PROOF'+'.pdf'));
      alert("You must select the die line first!");


      Thanks! Any help is greatly appreciated!