Printing Specific Separations With Scripting
Hi Community,
I'm trying to use python (via win32com) to print from Illustrator some desired separations of PDF files. Please see code below.
I do know that communication with Illustrator print options works: It indeed changes mode to HOSTBASEDSEPARATION as requested.
However, the document being sent to print using this method has all colors in it (separated to different spreads).
Also tried: sending inkList with only the requested separations, instead of sending all separations.
Am I doing something wronge? Did I forget some required steps?
Best regards,
Or
I'm Using Illustrator 2021, python 3.7.
import win32com.client as win32com
# Access the document opened in Illustrator
adobe_app = win32com.GetActiveObject("Illustrator.Application")
adobe_document = adobe_app.ActiveDocument
#Initialize required variables
print_color_management_options = win32com.Dispatch("Illustrator.PrintColorManagementOptions")
printer = win32com.Dispatch("Illustrator.Printer")
print_option = win32com.Dispatch("Illustrator.PrintOptions")
print_color_separations_options = win32com.Dispatch("Illustrator.PrintColorSeparationOptions")
# change mode to PrintColorSeparationMode.HOSTBASEDSEPARATION, according to table in section 42.88 in the documentation.
print_color_management_options.ColorSeparationMode = 1
#Set Disable to all 4 Process colors, neglect 5th Spot Color.
ink_list = adobe_document.InkList
for idx in range(len(ink_list)-1): # For all except the last
ink_list[idx].InkInfo.PrintingStatus = 2 # According to section 42.59 in the documentation.
print_color_separations_options.InkList = ink_list
# Update options and send to print
print_option.ColorSeparationOptions = print_color_management_options
adobe_document.PrintOut(print_option)
