DynaPDF produces 'Rich Black' not black

Im told that my RGB colorspace PDF files from DynaPDFMBS are producing ‘Rich Black’ for RGB(0.0,0.0,0.0) areas.
This is something to do with color profiles.
Is there a way to ensure that my blacks don’t end up as rich black at the other end?
Some ‘hint’ I can add to the file?

In RGB Colorspace 0,0,0 is black… just like &C000000 is black

How is this causing a problem?

Do you init color management?

call InitColorManagement method with flag kicmBPCompensation?

Yup.
My blacks are RGB(,0,0)

When the recipients turn that into CMYK, they assume that you want a deep black and turn it into ‘black plus other colors’
For small text, that can cause registration errors… the text can look smudgy… rather like your home printer when it runs out of black and tries to create it by using all the other colors at once.

Google tells me:

[quote]Replacing rich black by true black in PDF documents
When it comes to printing then all colors in a PDF document are transformed to the native color space of the printing device. If, e.g. a text uses a black RGB color then it is transformed to an equivalent CMYK value which contains contributions from all four color channels. In particular in mass printing applications these “rich black” values are not wanted, however, and it is required to use “true black” colors which use the K channel only. "

Rich black colors are usually created by color management systems (CMS) which are used in viewers or printing applications. The transform itself uses the ICC color profiles of the source and target device. If the source e.g. is an sRGB color space then the black is first transformed to the linear XYZ space then to the Lab space and then these values are used to lookup the equivalent CMYK values using the color profile of the printing device.[/quote]

I once tried to use CMYK colorspace in the PDFs but that seemed to make no difference (maybe I just didnt know what I was doing)
and in any case , what a faff…

[quote]Do you init color management?

call InitColorManagement method with flag kicmBPCompensation?[/quote]

I havent been using those calls. Will give that a try.

Initcolormanagement seems to want color profiles as a parameter.
Since there could be many targets, and I have no idea what a color profile is or how to create one, I dont know what to provide to this function call.

I tried

call pdf.InitColorManagement (,,pdf.kicmBPCompensation)

(the first parameters are optional
,but I get a syntax error.)

What is the syntax if the customer wants to target a CMYK system and I am providing colors in RGB in the PDF?
(I cant find any examples for this)

[code]dim profiles as new DynaPDFColorProfilesMBS

Profiles.DefInCMYK = nil // default
Profiles.DefInGray = nil // default
Profiles.DefInRGB = nil // default
Profiles.DeviceProfile = nil // default sRGB
Profiles.SoftProof = nil // default

dim r as boolean = pdf.InitColorManagement(profiles, pdf.kcsDeviceRGB, pdf.kicmBPCompensation)[/code]

this would use only default things.
But you may want to define a device profile like a CMYK profile for a printer.

And provide a default profile for CMYK if you have one.

Thanks for that. That compiles.
Maybe that will be enough.

is pdf.kcsDeviceRGB correct if the target system wants CMYK?

However

:slight_smile:

“Black point compensation preserves the black point when converting CMYK colors to different color spaces”
Isnt that the other way around?

Hi Jeff

To solve this you might need to change how you are generating your PDFs.

I assume that you are setting your text fill / stroke colour to a DynaPDF RGB colour.

What is probably happening is that the RIP doesn’t understand that RGB 0,0,0 is black so it is mixing it like any other colour.

What you can do is check for RGB 0,0,0 and instead of creating a DynaPDF RGB colour, create a DynaPDF CMYK colour with 100% K.

You could take things further and convert any grayscale RGB value (R/G/B the same) to be either a percentage of K or a value in the device gray colour space. Remember that CMYK intensity is the opposite of RGB so you might need to calculate your values something like 1 - (v / 255).

If you really want to get clever you could have a settings panel that allows this all to be controlled. For example, you might want rich black at certain sizes and pure black at others. You might also want to control overprint.

Note. when viewing your PDF I recommend that you only use Acrobat. Most other PDF viewers (including macOS Preview) render them incorrectly.

that suggests either setting the colorspace of the whole PDF to be CMYK, and translating all colors myself from their existing RGB values.
Or perhaps it is possible to switch to CMYK colorspace while setting text such as headers , footers , and page numbers, but RGB colorspace while doing graphics work?

eg this kind of switching?

[code]if then
call pdf.SetColorSpace (pdf.kcsDeviceCMYK)
//now set a CMYK color
dim m as new MemoryBlock(4)
m.Byte(0) = 0
m.Byte(1) = 0
m.Byte(2) = 0
m.Byte(4) = 255
call pdf.SetFillColorEx m,4

else
call pdf.SetColorSpace (pdf.kcsDeviceRGB)
//now set an RGB color
call pdf.SetFillColorEx 167,22,98

end if[/code]

No need for memoryblock. You can use SetFillColorEx with 4 color parts, I think.

[quote=410522:@Jeff Tullin]that suggests either setting the colorspace of the whole PDF to be CMYK, and translating all colors myself from their existing RGB values.
Or perhaps it is possible to switch to CMYK colorspace while setting text such as headers , footers , and page numbers, but RGB colorspace while doing graphics work?
[/quote]

Just switch colour space at the point you are going to draw text (or vector graphics).

I wouldn’t convert all colours to CMYK as to do this accurately you really need to know the destination (output) ICC profile to perform the RGB to CMYK conversion.

You might also want to look at how you are handling RGB colours. Currently, you are specifying DeviceRGB which is not calibrated. This means that the RGB values are taken literally and could be interpreted differently by different output devices (ie: different shades of colour). To make your RGB colours more consistent across output devices you should look at using a calibrated colour space such as sRGB. To do this you would need a sRGB ICC profile, use CreateICCBasedColorSpace to create a handle from the ICC Profile data / file when you first create your PDF and then use SetExtColorSpace(colourSpaceHandle) instead of SetColorSpace(kcsDeviceRGB).

If you are adding pictures to your PDF you may also want to make sure that they have an ICC profile attached otherwise the pixel values will also be more open to interpretation by the output deivce.

Thanks!

Nightmare… I might not… :wink: