Skip to main content
September 9, 2016
Answered

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

  • September 9, 2016
  • 1 reply
  • 1448 views

Hello,

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

Jo

This topic has been closed for replies.
Correct answer

It would seem there is no access to PANTONE library from Extendscript, the solution consists to create a document with all tints we need, and open it to get some swatches we need to do the job.

Thanks to this thread:

https://forums.adobe.com/message/4569865#4569865

Jo

1 reply

Correct answer
September 9, 2016

It would seem there is no access to PANTONE library from Extendscript, the solution consists to create a document with all tints we need, and open it to get some swatches we need to do the job.

Thanks to this thread:

https://forums.adobe.com/message/4569865#4569865

Jo

September 15, 2016

Finally there is a solution to correctly add some PANTONE swatches to a file without any elements in these tints:

the solution consist to create an empty file before (a .pdf file for example). In this file we must add spot colors with names of the PANTONE swatches we want (thus we need the list of PANTONE swatches, it's easy to find it on the web), and setup CMYK tints like we want as fake colors. Of course we must create one polygons for one PANTONE swatch to add on this document.

After this step, just import this file in the file to work, and you can see that the file where is imported the first file created replace the fake tints by the correct tints of each PANTONE swatches, so if you correctly add names of your PANTONE swatches in the first file (like it for example: "PANTONE 132 C"), your file to work should be perfect.