Printing industry has many standards and modern printing devices actually operate with colors using specific colorspaces different from well-known sRGB or AdobeRGB. One of the widely used colorspaces is CMYK [Cyan, Magenta, Yellow, blacK] and when you have to convert a PDF page prepared for publishing in CMYK to jpeg or other raster format, you have to apply a color transform because CMYK bitmaps don’t have the level of support they should have gotten in software tools.
Luckily, PDF defines a standard way to handle this conversion – ICC color profiles, these profiles define the conversion rules and contain all data needed to perform the transformation. Profiles are being created considering the target device or medium (or both), e.g. a special kind of paper, printer model etc. There are lots of publicly available color profiles, and some of them became more popular than others.
PDF standard supports content drawn in, so-called, Device CMYK colorspace – a “generic” CMYK colorspace that doesn’t have any associated transformation data. It becomes transformed to RGB or any other colorspace according to rules specified by the DEVICE used to present the content, hence the naming Device CMYK. Sometimes a color profile gets embedded into the file and special type of colorspace named ICCBasedColorspace is used to reference it. It makes content color transformation independent from the device as it defines its own transformation to the target colorspace for all colors that belong to ICCBasedColorspace.
/// This program demonstrates how to use custom CMYK profile for
/// CMYK to RGB transformation.
static void Main(string args)
string outputFileName = "output.png";
using (Stream stream = File.OpenRead("../../data/cmyk.pdf"),
profileStream = File.OpenRead("../../data/profile.icc"))
// set global CMYK profile to be used
// for CMYK -> RGB conversion,
// it's also possible to pass engine settings as a parameter
// during Document object creation.
using (Document doc = new Document(stream))
Bitmap result = doc.Pages.Render(
new Resolution(96, 96),
The complete example can be found in our github repository.
Original PDF document, shown in PDF reader:
Pic. 1 Original PDF file in CMYK
Converted using Apitron PDF Rasterizer (default profile):
Pic. 2 Converted using default CMYK profile
Converted by Apitron PDF Rasterizer using custom profile set using EngineSettings class:
Pic. 3 Converted using custom CMYK profile
Apitron PDF Rasterizer for .NET is a powerful library that allows you to do more by doing less. You can customize PDF to image conversion results by using its rich and smart API, and if you need a base to start with, we have lots of ready to use samples. Nowadays, .NET is not limited to Windows ecosystem and runs on iOS and Android (thanks to Xamarin) as well as any Mono-aware platform, and our tools are not exclusion. Whenever you need any help, just let us know and get a guaranteed reply from our techies.