Color conversion with APDFL

Color conversion with APDFL

The correct display of color on different devices has always been an important part of PDF technology. Using the correct color model when working with documents allows for more predictable results. Different color models can be used to achieve different things. Need to use a document in a print workflow? A CMYK color space will mimic how the ink will look on paper. Is the output meant for a computer monitor? An RGB color space can display a larger color gamut than CMYK can.

In the APDFL 10.1.0P4s release, the tools for color conversion were made available to the .NET and Java interface making the process of color converting a document really easy.
The color conversion process can be applied on three different levels:
1. Document level.
2. Page level.
3. Element level.

At the Document and Page level, it is possible color convert the entire content or only certain types of content. For example, in a document with many images, a specific action can be applied to images in the RGB color space, while a different action is applied to images that use a CMYK color space, the API can differentiate between the different content types such as text, line art, transparency, etc. Alternatively, color conversion can be applied to individual elements the document with a single function call.

Lets look at a quick example on how to convert a PDF to the sRGB colorspace using C#. This code will also embed the profile in the document making the content more reliably readable in different workflows:

Learn more about Adobe PDF Library and start your free eval today.

3 thoughts on “Color conversion with APDFL

  1. I heard that applying colors is considered in a delicate process which needs to be taken care in context the audience & the environment of the website you want to modify. So I started reading articles related color code conversions. What I found in your article is a simply unique thing that we can apply or convert PDF or any DOC with sRGB. I think this is very amazing or even more impressive thing that one can enjoy using any doc which is full of colors rather than only black and white. I accept the choice is highly individual but still, I have tried this code and it works for me. Very impressive work. I am looking forward to new codes like this. Thanks for sharing.

    1. Hi David,

      Thank you for your question. The Color Conversion APIs are generally meant to manage color in display devices, not printing. The APDFL print interface will print to the color model and profile supported by the printer. Setting up the printer to grayscale would be the recommended method.

      That being said, using the example code above, setting the parameter:
      action.ConvertProfile = ColorProfile.DotGain20
      or
      action.ConvertProfile = ColorProfile.Gamma22

      will apply a DeviceGray ColorSpace to the entire document and result in grayscale output when printed. This is an expensive operation, and it may take longer for complex documents. While there may be issues in documents that use translucent ink, for most documents, including translucent documents, this should work fine.

      If you would like to discuss a particular problem you are trying to solve, I can be reached at
      aarroyo@datalogics.com

Leave a Reply

Your email address will not be published. Required fields are marked *