pdf links

PDF Rendering
Convert PDF to Image (.NET)
Convert PDF to image on Android (Xamarin)
Convert PDF to image on iOS (Xamarin)
Convert PDF to image in Windows Store apps (.NET)
Convert PDF to image in Windows Phone apps (.NET)
PDF to image in Universal Windows Store apps (.NET)
Free PDF Viewer control for Windows Forms (.NET)
How to integrate PDF Viewer control in WPF app (.NET)
Creating WPF PDF Viewer supporting bookmarks (.NET)
Cross-platform PDF Viewer using GTK# (MONO)
Silverlight PDF viewer control (Silverlight 5)
Multithreaded PDF rendering (.NET)
Convert pdf to image in Silverlight app (C# sample)
How to set fallback fonts for PDF rendering (C#)
Avoiding the out-of-memory exception on rendering (C#)
PDF viewer single page application (WebAPI, AngularJS)
PDF viewer control for Windows 10 universal applications
Use custom ICC profile for CMYK to RGB conversion
PDF layers - separate images, text, annotations, graphics

PDF Forms Creation PDF Security
Conversion to PDF/A
Other topics
PDF Document Manipulation
PDF Content Generation
Fixed and Flow layout document API (.NET)
Creation of grids and tables in PDF (C# sample)
How to create interactive documents using Actions (C# sample)
Text flow effects in PDF (C# sample)
How to generate ordered and bulleted lists in PDF (C# sample)
Convert HTML to PDF using flow layout API (C# sample)
How to use custom fonts for PDF generation (.NET)
Create document with differently sized pages (C#)
Create PDF documents using MONO (C#/MONO/Windows/OSX)
How to use background images for content elements (C#/PDF Kit/FlowLayout)
Add transparent images to PDF document (C#)
Draw round rect borders in PDF documents(C#)
ICC color profiles and and ICC based colors in PDF (C#)
How to use bidirectional and right to left text in PDF (C#)
Create PDF documents from XML templates (C# sample)
How to resize PDF pages and use custom stamps (C#)
Add header and footer to PDF page (.NET sample)
How to use clipping mask for drawing on PDF page
Fill graphics path with gradient brushes in PDF (Shadings)
Apitron PDF Kit and Rasterizer engine settings
Add layers to PDF page (optional content, C# sample)
How to create free text annotation with custom appearance

PDF Content Extraction
PDF Navigation

PDF to TIFF conversion
Contact us if you have a PDF related question and we'll cover it in our blog.

2015-10-10

ICC color profiles and ICC-based colors in PDF

Introduction


In color management, an ICC profile is a specific set of data that defines the color representation of the color reproduction device. Common term for this characteristic is “colorspace”.  Therefore each color reproduction device works with its own colorspace, and the rules used to manipulate colors within each colorspace, or to convert them between colorspaces are described in standards created by the International Color Consortium, hence the name ICC. Examples of well-known colorspaces are: RGB, CMYK, GRAY, LAB and XYZ.

A manufacturer of a color reproduction device may include a color profile along with the device for better color management. You may use these profiles and create PDF files which will include all data needed for reproduction on a selected device. Drawing primitives using colors defined by the ICC profile is possible with Apitron PDF Kit, and we’ll show you how to do it in our code section.

Code sample


Consider the code below. It adds two rectangles to PDF page using same colors from CMYK colorspace. The difference is in the way of defining these colorspaces, in first case we’re using ICC color profile downloaded from Adobe website, and in the second case we rely on default behavior provided by the PDF viewer – by means of the colorspace called DeviceCMYK in PDF specification.

static void Main(string[] args)
{
    using (Stream outputStream = File.Create("icccolors.pdf"))
    {
        using (FixedDocument doc = new FixedDocument())
        {
            // register CMYK profile "US Web Uncoated v2",
            // you can get it from Adobe website
            string profileName = "US Web Uncoated v2";
            doc.ResourceManager.RegisterResource(new ICCBasedColorSpace(profileName,
 File.ReadAllBytes("../../data/USWebUncoated.icc")));

            // create and add new page
            Page page = new Page();
            doc.Pages.Add(page);

            // create rectangular shape
            Path rectangle = new Path();
            rectangle.AppendRectangle(10,700,200,100);
                   
            // RECT 1
            // select CMYK colorspace for drawing using loaded color profile
            page.Content.SetNonStrokingColorSpace(profileName);
            page.Content.SetStrokingColorSpace(profileName);

            // select fill and stroke colors
            page.Content.SetNonStrokingColor(new double[]{0,1,0,0});
            page.Content.SetStrokingColor(new double[]{0,0,0,1});

            // fill and stroke the path
            page.Content.FillAndStrokePath(rectangle);
                   
            //RECT 2
            // select colors using device CMYK colorspace, the viewer will
            // use default CMYK profile for representing these colors
            page.Content.SetDeviceNonStrokingColor(new double[] { 0, 1, 0, 0 });
            page.Content.SetDeviceStrokingColor(new double[] { 0, 0, 0, 1 });

            // fill and stroke the path again
            page.Content.Translate(0,-120);
            page.Content.FillAndStrokePath(rectangle);
                   
            //save document
            doc.Save(outputStream);
        }
    }
}


Resulting document is shown on the image below (callouts are not the part of the generated document, they were added later for clarification).


Pic. 1 Paths drawn using colors from ICC colorspace and DeviceCMYK colorspace

You may clearly see the difference between the two. In first case we used the profile named “US Web Uncoated V2”, according to information about this profile that can be found on the internet, it is “designed to produce quality separations using U.S. inks under the following printing conditions: 260% total area of ink coverage, negative plate, uncoated white offset stock”.

The second one uses default CMYK color profile that is called DeviceCMYK in PDF specification, it seems that Adobe substitutes the profile named “US Web Coated (SWOP) v2” in this case, but we’re not 100% sure.

Using the correct color profile supplied with color reproduction devices, you may prepare your PDF documents for professional printing and avoid color misrepresentations related to color profile difference.

Conclusion


Using ICC colorprofiles, you may create PDF documents ready for professional printing and reproduction. Apitron PDF Kit for .NET component provides all necessary APIs for achieving this goal. You can download it on our website (link) and try for yourself. Create cross platform applications using our .NET PDF components and enjoy the quality of our software and support services. 

Downloadable version of this article can be found by the following link [PDF].

No comments:

Post a Comment