Skip to main content
Inspiring
June 30, 2023
Answered

C++ GetInksUsedOnSpread on an EPS with setcmykcolor

  • June 30, 2023
  • 5 replies
  • 851 views

So let's say you place the following trivial EPS into a blank InDesign document:

 

%!PS-Adobe 2.0 EPSF-1.2 
%%BoundingBox: 0 0 10 10
%%EndComments
%%EndProlog

0 0 1 0 setcmykcolor

0.1 setlinewidth
2 2 newpath moveto
9 9 lineto
stroke

showpage

 

That creates a yellow diagonal line.  Now in C++ you do the following, presuming `spreadRef` is a reference to the spread where the EPS was placed:

 

Utils<IInkMgrUtils> inkMgr;
UIDList spreadInks = inkMgr->GetInksUsedOnSpread(spreadRef, 0);

 

`spreadInks` contains four colors - cyan, magenta, yellow and black. I would have expected it to just contain yellow, because that's the only color in the EPS. If you create a process swatch that has 100% yellow and 0 black, magenta, and cyan, and apply it to a page item, then execute that code, `spreadInks` only has yellow.  But with the EPS, it gets all four colors.

 

Any thoughts from anyone on a way to see from InDesign what colors an EPS is actually using? 

This topic has been closed for replies.
Correct answer Brad @ Roaring Mouse

"I would have expected it to just contain yellow"

Nope. Your color is defined a 0C 0M 100Y 0K. All four inks are spec'd in that definition, even though 3 of them are zero.

Where are you creating the swatch? in InDesign?

 

5 replies

Inspiring
July 3, 2023

I think ultimately Brad's response is the correct one - once usecmykcolor is used in PostScript, all four inks are seen as used, even if they're set to 0.  So even via C++, there doesn't seem to way to truly identify all inks used.

 

There is a `kInksRIDXNotifierHandlerBoss` in the C++ SDK, but I don't think I'm going to pursue it, since I suspect it'll ultimately come to the same result. I have an application-specific path to pursue to get the result I need.

 

@James Gifford—NitroPress yes EPS is not widely used anymore, but PostScript is. For example, PDFs are based on PostScript, and you can reproduce this same issue described here with a PDF file. However, EPS files are in my experience the quickest and easiest way to debug PostScript issues. It's a lot easier to edit an EPS file in a text editor than it is a PDF file.

Brad @ Roaring Mouse
Community Expert
Community Expert
July 4, 2023

"PDFs are based on PostScript, and you can reproduce this same issue described here with a PDF file"

beat me to it. 🙂

Community Expert
July 1, 2023

Hi Rob, @Lawrence Horwitz said:

"If you create a process swatch that has 100% yellow and 0 black, magenta, and cyan, and apply it to a page item, then execute that code, `spreadInks` only has yellow. But with the EPS, it gets all four colors."

SDK:

 

inkMgr->GetInksUsedOnSpread(spreadRef, 0);

 

 

So, obviously inkMgr is able to do something we cannot do by scripting.

 

As far as @Lawrence Horwitz  said this is working for page items, but obviously does not work with a linked and placed (or embedded) graphic like an EPS file. Sounds like a feature for native InDesign page items only.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

James Gifford—NitroPress
Legend
June 30, 2023

I'm surprised Rob didn't say this — as EPS is an almost wholly obsolete format, this seems like a problem that is best solved by avoiding the image format altogether. Do you have a specific reason for needing to place and then analyze EPS images, given the many more modern and flexible options?

rob day
Community Expert
Community Expert
June 30, 2023

Hi James, I think it would happen with any placed object—at least with scripting. I think @Lawrence Horwitz  was just using EPS as an example.

 

A document always has a minimum of 4 inks no matter what colors or swatches are used. So a doc with a single 100% Yellow fill still lists the 4 process inks even though Cyan, Magenta, Black and PANTONE Orange 021 C are not being output:

 

rob day
Community Expert
Community Expert
June 30, 2023

Hi @Lawrence Horwitz , Not sure if this helps, but in scripting inks are a property of the application or document (pages and spreads don’t have an inks collection). A document always has a minimum of 4 inks (the process CMYK inks), so even with an empty document this script:

 

 

var di = app.activeDocument.inks
var s = 'Document Inks\r'
for (var i = 0; i < di.length; i++){
    s+= di[i].name + "\r"
};   
alert(s)

 

 

Returns this:

 

 

You can’t get at an EPS’s color usage inside of InDesign via scripting, but if you can with C++ maybe loop through the colors’ values and check for values greater than 0?

Brad @ Roaring Mouse
Community Expert
Brad @ Roaring MouseCommunity ExpertCorrect answer
Community Expert
June 30, 2023

"I would have expected it to just contain yellow"

Nope. Your color is defined a 0C 0M 100Y 0K. All four inks are spec'd in that definition, even though 3 of them are zero.

Where are you creating the swatch? in InDesign?

 

Inspiring
June 30, 2023

In the first case I described, where I create an EPS and place it in InDesign, I actually deleted all the swatches that could be deleted from InDesign.  The yellow comes from the `setcmykcolor` call in the EPS itself.

 

So it sounds like you're saying there's no way to use a single process color in an EPS and not have InDesign see all four CMYK inks being used, right?