Skip to main content
Inspiring
February 7, 2023
Answered

Activate overprint fill to selection / objects / swatches with script.

  • February 7, 2023
  • 2 replies
  • 1081 views

Hi community, I don't really have a code to show for this, but I was trying to find out how to set the overprint fill attribute to my object/selection/swatches, I wrote it like this because I am not sure how does it work, all I know is that to activate overprint filll for text frames is:

 

text.textRange.characterAttributes.overprintFill = true;

 

Can anyone help me out with that? Thank you.

 

(P.s.: I did look at the documentation for scripting but all I found is overprint for pdf files something like that)

This topic has been closed for replies.
Correct answer m1b

You might need some more code to handle CompoundPathItems and GroupItems. For example

if (doc.selection[i].constructor.name == 'CompoundPathItem')
     doc.selection[i].pathItems[0].fillOverprint = true;

And GroupItems have pageItems, so you can do another loop over the group's pathItems and set each of their fillOverprints too.

- Mark

2 replies

Inspiring
February 8, 2023

Hi! I made this:

 

var doc = app.activeDocument;
var layers = doc.layers;
doc.artboards.setActiveArtboardIndex(0);
layers.hasSelectedArtwork = true;
for(var i=0; i < doc.selection.length; i++){
doc.selection[i].fillOverprint = true;
}

 

and in fact it activates the fill overprint attributes, I just don't know why somethines it does not activate for compound path items, but so far... this works! Hope it helps.

m1b
Community Expert
m1bCommunity ExpertCorrect answer
Community Expert
February 11, 2023

You might need some more code to handle CompoundPathItems and GroupItems. For example

if (doc.selection[i].constructor.name == 'CompoundPathItem')
     doc.selection[i].pathItems[0].fillOverprint = true;

And GroupItems have pageItems, so you can do another loop over the group's pathItems and set each of their fillOverprints too.

- Mark

m1b
Community Expert
Community Expert
February 7, 2023

Hi @AntonioPacheco, have another look at the docs, for example PathItem has fillOverprint and strokeOverprint properties. - Mark

Inspiring
February 7, 2023

ohh wow I didn't know about that web page! Normally I use https://ai-scripting.docsforadobe.dev/
Let me take a look.

m1b
Community Expert
Community Expert
February 7, 2023

Yes it has some more up-to-date info, but is almost the same. The page on PathItem seems to be the same.