Forum How do I...?

Some pages only in CMYK - black

stefan55874
Hi everyone,

I'm hoping to get some help with generating a PDF using PrinceXML where specific pages should be printed in black (and white) only. I've tried using the following CSS properties:

prince-pdf-output-intent: url(ISOcoated_v2_300_eci.icc);
prince-pdf-color-conversion: output-intent;
filter: grayscale(1);


However, when I preview the PDF in Adobe Preflight, I see that all the elements to which the grayscale filter is applied will still be printed in all CMYK colors. My goal is to ensure that only "black(K)" is used for these elements.

I've searched the PrinceXML documentation and forums, but I haven't been able to find a solution that works for me. I'm wondering if anyone else has encountered this issue and has a solution to share.

Any help would be greatly appreciated!

Thanks a lot!
mikeday
I think it would be best to avoid applying a grayscale filter and instead use color conversion with a grayscale ICC profile, something like this:
@prince-pdf {
    prince-pdf-color-conversion: url(ConvertToK_ISOcoated.icc) no-embed;
}
body {
    prince-pdf-color-conversion: none;
}
.bw {
    prince-pdf-color-conversion: auto;
}

You can find suitable grayscale ICC profiles here:

https://ninedegreesbelow.com/photography/lcms-make-icc-profiles.html
https://github.com/ellelstone/elles_icc_profiles/tree/master/profiles

The prince-pdf-color-conversion property/descriptor is explained in the docs:

https://www.princexml.com/doc/graphics/#color-conversion
https://www.princexml.com/doc/css-props/#prop-prince-pdf-color-conversion
stefan55874
Thank you so much for your support! I just received the feedback from the printing company and everything seems to work perfectly!

Just for reference, here's exactly what worked for me:

@prince-pdf {
    -prince-pdf-color-conversion: url(Dot_Gain_15.icc) no-embed;
    -prince-pdf-output-intent: url(ISOcoated_v2_300_eci.icc);
}

body {
    -prince-pdf-color-conversion: none;
}

.bw * {
    -prince-pdf-color-conversion: auto;
}


If I understand correctly, it works by converting all elements with the .bw class to the color profile specified in the -prince-pdf-color-conversion value. Here, I have deposited a profile that only allows black values. Then at the end, when the PDF is generated, the color profile specified in the -prince-pdf-output-intent value is applied to the PDF. However, since the .bw elements already only have black values, these are retained.

Thank you!
wangp
The latest build 20240626 introduces a new keyword 'cmyk-grayscale' for the -prince-pdf-color-conversion property in the @prince-pdf rule:
@prince-pdf {
    -prince-pdf-color-conversion: url(SomeProfile.icc) cmyk-grayscale;
}

This will enable color conversion to the SomeProfile.icc color space, using only the K (black) channel in a CMYK color space; the CMY channels will have zero values. cmyk-grayscale has no effect if the target color space is not CMYK.

You can combine cmyk-grayscale with other keywords, e.g.
@prince-pdf {
    -prince-pdf-output-intent: url(SomeProfile.icc);
    -prince-pdf-color-conversion: output-intent cmyk-grayscale;
}

This requests conversion to the output intent color space, again using only the black channel of a CMYK color space.

The -prince-pdf-color-conversion property on elements can now take a 'cmyk-grayscale' value.
@prince-pdf {
    -prince-pdf-color-conversion: url(SomeProfile.icc);
}
.bw {
    -prince-pdf-color-conversion: cmyk-grayscale;
}

This requests color conversion to the SomeProfile.icc color space (and embeds the ICC profile). In addition, color conversion on elements with the 'bw' class will only use the black channel of a CMYK color space.

We would be interested to hear how this works in practice.