Color Management in XML2PDF Formatting Engine

By default all colours used in XSL-FO, SVG, XHTML and WordML files are given in the sRGB colour space. Aditionally XSL-FO recommendation includes the possibility to specify colours using any external ICC profile. XML2PDF Formatting Engine supports both sRGB colours and custom ICC profiles generating PDF documents that do not contain device-dependent colour spaces such as DeviceRGB. In particular, all ICC profiles referred by the source XSL-FO are embedded into the output PDF.

XML2PDF Formatting Engine supports also a number of conventions for RGB, CMYK, Grayscale, Spot and some other colours.

RGB colours

Colours can be named using the following naming schemes: color = "#RRGGBB" where RR, GG and BB are two digits hexadecimal numbers, color = "rgb(R%,G%,B%)" where R, G and B are percentage values of each (red, green and blue) channels and color = "rgb(R,G,B)" is also defined in percents but R, G and B have vaules between 0 and 1. Additionally, a colour can be referenced by its name, e.g.color = "orange"color = "black" or color = "aliceblue". 147 colours are recognized by their names. Note that all predefined colours are converted to RGB.

CMYK and Grayscale Colours

As an extension it is possible to use CMYK or grayscale colours using an extended colour description sytax: color = "rgb-icc(R,G,B,#CMYK,C,M,Y,K)"or color = "rgb-icc(R,G,B,#Grayscale,K)" where R, G and B are the alternative RGB colour values (not used within the current implementation), #CMYKor #Grayscale are colour space names to be used and (C,M,Y,K) or (K) are the corresponding colour values for CMYK and Grayscale. Each value must be given either in percents or as a number in the interval from 0 to 1. For example, to draw cyan use color = "rgb-icc(0,0,0,#CMYK,100%,0%,0%,0%)" or to draw gray use color = "rgb-icc(0,0,0,#Grayscale,0.5)".

Spot Colours

There is an extension for all colour attributes in all formats that allows to specify a spot colour directly from the source. The format for specifying the spot colour is:

color = "rgb-icc( R,G,B, #SpotColor,Name,Value )",
color = "rgb-icc( R,G,B, #SpotColor,Name,Value, #CMYK,C,M,Y,K )" and
color = "rgb-icc( R,G,B, #SpotColor,Name,Value, #Grayscale,Gray )".

Here R,G,B are alternative colour values in sRGB colour space and are used if spot colouring is not compatible with the output format (ignored in the PDF output). SpotColorName is the name of the spot colour, e.g. 'Orange'. SpotColorValue is the value between 0 and 1 and specifies the density of the colour. And C,M,Y,K are cyan-magenta-yellow-key values of the CMYK alternate and Gray is a gray value of the Grayscale alternate and they are used for the colour substitution if the named spot colour isn’t found in the printer.

For example, "rgb-icc(0,0,0,'Orange', 1.0)" or "rgb-icc(0,0,0,'Orange', 1.0, #CMYK, 0, 0.353, 1, 0)". We don’t keep the catalogue of the spot colors at the moment. Thus, in the first case PDF might look incorrectly in Adobe Reader due to the absence of the alternate representation. However, it will be printed correctly if the spot colour is within the printer.

Registration colours

In addition to spot colours, it is possible to specify registration colour using the following syntax:

color = "rgb-icc( R,G,B, #Registration, RegistrationColorValue)"

This colour specification will be converted to PDF using the Separation /All colour space.

System Colours

There is also the possibility to use system colours by their names. Use color = "system-color(SCN)", where SCN is the name of the system colour such as ActiveCaption or Background. For example, if you want to use the active border colour in the current system colour scheme, use color = "system-color(ActiveBorder)". Note that system colour is evaluated during file formatting on the system where it is formatted. Thus, the PDF output may vary on different systems.

ICC Colours

In XSL-FO format ICC colors are completely supported . The ICC profile location and properties are defined by the fo:color-profile tag. See the XSL-FO specification for details.

See the sample that demonstrates the use of extensions for defining CMYK, Gray, spot and registration colours.

Colour Management