Knockout or overprint fill thru script

I have 2 PMS colors on a page. They are overlapping. If you wanted to overprint or knockout the top object you would just click the box in the Illustrator 5 attribute menu. I want to do this through Applescript. I see 2 properties for the object.

1- fill overprint:(boolean) : will art beneath a filled object be overprinted?
This was by default false. Through the script I set this property to true but I do not think it is what I am looking for.

2 - knockout (disabled/Œenabled/Œinherited/Œunknown) : is the artwork used to create a knockout.
This was set to disabled. Through the script I did set this property to enabled. Will this now knock out the color below?

I created a small .ai doc for testing, which contains 2 PMS colors. I have a rectangle with the 1st color, an ellipse with the 2nd color(path Item2), and a polygon with the 2nd color(path item 3). Both 2 and 3 overlap the rectangle of the first color. I am trying to knockout the ellipse(path item 2) and let the polygon(path item 3) overprint. It seems like whatever I do makes no difference in how the ellipse prints.

Is there another way of doing it?
Any suggestion?

Thank you

local docRef
		set docRef to current document
		tell docRef
			set fileName to name of docRef
			log fileName
			set pathItemProperties2 to properties of (path item 2 of layer 1 of docRef)
			set knockout of pathItemProperties2 to enabled
			set fill overprint of pathItemProperties2 to true
			log pathItemProperties2
			set pathItemProperties3 to properties of (path item 3 of layer 1 of docRef)
			log pathItemProperties3
		end tell
	end tell
end script

-- to test
run ChangeOverprint

Hi rsweeny

Try something like this;

tell application "Adobe Illustrator"
	-- create 2 overlapping objects with just a fill no stroke set as spot colours
	set topObject to path item 1 of document 1 --reference the Top item in a variable
	set selection to topObject -- Not needed Just checking that it is the top item
	set fill overprint of the topObject to true -- checkbox in attributes panel now is checked
	--When printed as separations there will be no knockouts the top object is overprinting the object below it. If you want the top object to knockout of the object underneath then set the boolean value to false.
end tell

Hope this helps, I’ve never used the Knockouts property in layers so i can’t say what it’ll do exactly but i hope this is what your after.


That feature affects how a group’s transparency interacts outside the group, i.e., voiding a blending mode below it. Fill overprint is the same as manually setting the overprint attribute.

Thank you pidge1,

It does exactly what I want it to do. I realized the file overprint(boolean) affected the object below it. At least that is what the documentation tells you. I just couldn’t get how to set the attribute for the selected item and actually check the box in attributes. I tried a number of things and just couldn’t get it

Thank you for sharing expertise,
I appreciate it.