Render QGraphicsScene to pdf: black must have 0 for c, m, y values. How?
-
I render a QGraphicsScene to a pdf. It looks great on the screen, but when my users send it to their commercial printers, it's garbage because black is composed of multiple colors. For commercial printers who use CMYK, black in a pdf needs to have c, m, and y set to 0, and only k set to positive value.
When a pdf created by Qt is printed by commercial printers, black text and lines look like the old Sunday newspaper comics, where the colors are offset a bit - so it looks like garbage instead of sharp text. So, the printers need there to be no value for c, m, and y - only a value for k - to avoid the Sunday comics effect on black text and lines.
How can I achieve that in a pdf rendered from a QGraphicsScene?
-
Hi
Its using RGB and you must perform conversion if you need colors as CMYK
So you could grab the scene as an image and play around with
QColor::fromCmyk();
and
image.pixel(i,j)).toCmyk()
And its maybe possible printing the modified image.This has the "formula"
https://gist.github.com/wyudong/9c392578c6247e7d1d28There might be better ways im unaware of.
-
Thanks @mrjj - that looks like it may be worth pursuing, though grabbing the scene as an image tends to result in inferior quality in my tests. Unfortunately the business requirements I'm working under won't allow me the time to explore that possibility right now.
I also found this qt wiki page that suggests several third-party possibilities. Again, at this point I'm not able to take the time to track down how to use them to solve this issue, and I'm operating under a prejudice against third-party solutions in general.
I mention these things in case they are helpful to someone else. If priorities shift and I'm able to solve this issue, I'll post the solution here.
-
well there could easy be quality degradation.
I only tried with QWidgets using the render() function and got
acceptable quality, but that was not with hi-grade printers as you are using.Did you ever try to output to pdf and then use
Acrobat to change color space?
Tools->Print Production->Convert Colors
( or something like. maybe only in pro version these days.)Just for test :)
-
My app produces a pdf with black text (and dots and arrows) on a jpg background.
For grayscale pdf's, some of my users are using Acrobat Pro to promote gray to CMYK black. That is an acceptable workaround for my users, for grayscale pdf's. Irfanview's "Convert to Grayscale" feature works to convert RGB grayscale jpg's, and now that there's a pdf plugin, maybe it could help with pdf's, too. Would be great to have a free solution.
But for converting a color pdf created by Qt, the cleanup process is too tedious, using Adobe illustrator to turn on overprint individually for every text, so a 4-color commercial printer will not have any problems with slight misalignments.
In other words, if I understand my users correctly, the lack of layers in RGB is part of the problem for color pdf's. So where things stand for me: I don't have access to Acrobat Pro, Adobe Illustrator, or any paid tools like that. The current priorities mean I won't have time to spend on this. So I'm putting all the information I have here, in case it helps someone - and may eventually help me, too.
In lieu of an ideal solution, if someone knows a reasonably fast way to use AI or some other tool to turn on overprinting for all the RGB black in a pdf, preferably also converting the RGB to CMYK (without having to go through every item individually), that would be a huge help.