2 Replies Latest reply on Sep 15, 2016 8:45 AM by jonathanl85551599

    How to correctly add a PANTONE swatch in Illustrator with Extendscript?

    jonathanl85551599 Level 1



      I'm working on a script to generate several files in a printing process:


      - a file which contains a single item of the imposition

      - a file which contains the proof of the item (to send to customer)

      - a file which contains the imposition of items to print


      To automate a maximum the different actions of the process, I would like to add all the colors which are used on the printing item in the swatches of each generated files. I can have orders only in CMYK, or in CMYK plus 1, 2, or 3 PANTONE colors.

      There is no problem for me to add CMYK colors or custom colors built from CMYK tints in document swatches, but I don't know how I can add a PANTONE color in swatches. In fact, I generate blank files with all "parameters" I need to work correctly, and when all files are generated, I work only on the single item file (single item file which is imported by my script into the imposition file and the proof file).


      So my question is the following : to add a PANTONE color in swatches, is it better to "generate" it with CMYK colors (and add it in swatches like a ColorModel.SPOT) or is it possible (and probably better) to add it from the PANTONE library?


      For example I add my custom spot colors with this function:


      function addSpot(name,c,m,y,k){  
          try {    
              swatch = app.activeDocument.swatches[name];   
              addSpot (name+='1', c, m, y, k);  
          catch (e) {    
              var newSpot = app.activeDocument.spots.add();    
              newSpot.name = name;    
              var newColor = new CMYKColor();    
              newColor.cyan = c;    
              newColor.magenta = m;    
              newColor.yellow = y;    
              newColor.black = k;    
              newSpot.colorType = ColorModel.SPOT;    
              newSpot.color = newColor;    
              var newSpotColor = new SpotColor();    
              newSpotColor.spot = newSpot;    


      What's the best way to add a PANTONE color in document swatches, even if the document have no element?


      Thanks a lot in advance for your replies