Copy link to clipboard
Copied
Hi
We create all our documents using a Text black colour separation. I've noticed that a lot of documents this swatch has been set to overprint within attributes. I would prefer it if all the character styles and paragraphs with the swatch 'text black' could be set to overprint in a script - there are a lot of styles to go through and check on the overprint.
Many thanks
Hi,
Try this code..
var myDoc = app.activeDocument;
var PStyles = app.activeDocument.paragraphStyles.everyItem().getElements();
for(i=2; i<PStyles.length; i++)
{
PStyles.fillColor ="BLACK";
PStyles.overprintFill = true;
}
var CStyles = app.activeDocument.characterStyles.everyItem().getElements();
for(i=1; i<CStyles.length; i++)
{
CStyles.fillColor ="BLACK";
CStyles.overprintFill = true;
}
Copy link to clipboard
Copied
Hi,
Try this code..
var myDoc = app.activeDocument;
var PStyles = app.activeDocument.paragraphStyles.everyItem().getElements();
for(i=2; i<PStyles.length; i++)
{
PStyles.fillColor ="BLACK";
PStyles.overprintFill = true;
}
var CStyles = app.activeDocument.characterStyles.everyItem().getElements();
for(i=1; i<CStyles.length; i++)
{
CStyles.fillColor ="BLACK";
CStyles.overprintFill = true;
}
Copy link to clipboard
Copied
This is great - thank you!!!!
Copy link to clipboard
Copied
Sorry I've only just noticed that if i have other paragraph styles which aren't 'text black' they're being converted. For example we have folio's which are set up as a white which obviously don't need to overprint. When i run the script it converts the white to 'text black'.
Copy link to clipboard
Copied
Hi Davis,
Ananth's script will change all custom paragraph styles and all custom character styles, that are stored in the root of your styles panels. That's one reason I wrote my reply #2 above.
Regards,
Uwe
Copy link to clipboard
Copied
Hi Davis,
technically you cannot set a Swatch (or a Color) itself to overprint. Not with InDesign.
You have to do this with text formatting. For fill and stroke independently.
With color [Black] it's a bit different.
Overprinting [Black] can be controlled document wide from the preferences.
For an active document this would be:
app.documents[0].documentPreferences.overprintBlack = true;
As a preference for new documents this would be:
app.documentPreferences.overprintBlack = true;
Now for your problem with a swatch named "text black".
Are there already any paragraph styles or character styles where a different color is overprinting?
The answer to that could be important for the code you will run.
A naive approach:
Basically we could loop through the allParagraphStyles array and the allCharacterStyles array of the document to catch all styles organized in groups.
While looping we check for the values of:
fillColor.name
and
strokeColor.name
If the name is "text black"—the name of your swatch you like to overprint—set overprintFill or overprintStroke of the paragraph style to true.
Done. Easy. Sounds like a good plan.
But isn't.
Why? Could be that paragraph styles and character styles are based on each other.
And if you change the attribute of one to overprint the fill color, the ones that are based on this particular style will follow.
Even if the fill color is not the one you like to overprint.
Regards,
Uwe
Copy link to clipboard
Copied
Sorry - just gone back over your message. Got carried thinking it was working. All makes sense. Looks like this might be easier and more importantly safer doing manually?