1

This might be asking alot. I've been looking everywhere for some sort of tool (command line, Python, whatever) one could use to check whether CMYK objects that are not 100% black are set to overprint in a PDF. I'd just like to flag them.

I don't have $500 to burn on Callas - it's hard to believe that for as long as PDF, UNIX and Prepress has been around, there's so few open source tools to use for preflighting. (Unless you know of one!)

My question is one of plan of attack. I'd like some expert advice on what direction I can take.

My research has yielded:

XMP Metadata: I ran exiftool -v on a file with color set to overprint, and it returned a "HasVisibleOverprint" tag that was set to true. I have not been able to duplicate this, even on the same file! That tag seems to have disappeared, and I have no idea why I saw it in the first place (what I did different). Exiftool also lists 'ExtGState' - which has 'OP, OPM and op' values. But, will these values change if, for example, black text is set to overprint (as is default in InDesign)? Would it be worth my time to learn enough C++ to use XMP SDK?

GhostScript: I believe this can also do what I need - however there's a decent learning curve here. I don't mind taking the time to wrap my mind around this solution, but I'd like to know if GhostScript can even accomplish my task. I got close looking at the 'tiff32nc' device, and found this question interesting CMYK Overprinting and Knockout in Ghostscript.

PDFBox: This may be able to do what I need, but again, big learning curve as I don't know alot of Java. I've got some Python under my belt though. - and again, can this even do what I'm trying to do?

muPDF: This one was interesting, when I ran mutool trace overprint.pdf, this printed out what appears to be style information for the objects on the page. There are tags like <fill_text colorspace="Separation" color="1" matrix="1 0 0 -1 0 401.995"> What does that color describe?

Am I in the weeds? Does anybody know if what I'm trying to do is possible? I'd like to be nudged in a direction - though if anyone can offer some insight, it's always welcome!

detonationbox0
  • 105
  • 1
  • 1
  • 7

1 Answers1

1

You could have Ghostscript report if overprint is ever set to true in a file. You could then track execution of setcmykcolor and setcolorspace/setcolor. But that wouldn't tell you whether a CMYK color was actually used.

To do this reliably with Ghostscript you would need to write an output device which would receive all the marking operations. Each of those would then check the graphics state to see if overprint was set and what the current colour space is.

MuPDF is probably easier to work with for this, and the trace tool would emit what you want, then you'd need to analyse the output. Or you could just use the trace tool as a skeleton to write your own around. FWIW Separation spaces have a value between 0 1nd 1, so in this case 1 means 100% ink.

There are some tricky questions to answer though; what do you plan to do about images ? What about shaded fills ? How do you plan to determine if an exotic colour such as ICCBased or DeviceN is equivalent to 100% black, or don't you care ?

KenS
  • 30,202
  • 3
  • 34
  • 51
  • What I want to catch are shapes or text that have, for example, a fill of 100% Cyan that sit on a background of 100% black. If that object is set to overprint, it disappears into the black. So ideally, it would be able to detect an object that has > 0 in the CM or Y, and <= 100 in the K. If that object is also overprinting, I could return a bool and there's my flag. I don't mind parsing the result of the MuPDF Trace tool - could you give me an idea of how a tag indicates an overprint? I was hoping `color` was it - but you clarified that one. – detonationbox0 Jun 29 '18 at 21:19
  • I'm sorry but I'm not a MuPDF developer. I just looked in the source code and it was reasonably clear what the result meant. I'd guess that something will be printed when the graphics state changes and that's where the overprint flag (and overprint mode) is stored for PDF. You could try going to the #mupdf channel on irc.freenode.net and ask the developers (best times Monday-Friday, 10 am onwards UK time) – KenS Jun 30 '18 at 08:04
  • Thanks for your help - I'll look into what you mentioned about the graphics state - if I find anything useful, I'll post back. – detonationbox0 Jul 02 '18 at 13:12