This sample shows how to load an ICC profile and then create and use a color with that color profile.

In addition to device-dependent colors Docotic.Pdf library can also use colors with associated color profiles. To use color profiles, first add a color profile to your document using PdfDocument.AddColorProfile method and then use the returned PdfColorProfile object as a parameter when creating a color.

C#
using System.Diagnostics;
using System.Drawing;

namespace BitMiracle.Docotic.Pdf.Samples
{
    public static class ColorProfiles
    {
        public static void Main()
        {
            // NOTE: 
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            using (PdfDocument pdf = new PdfDocument())
            {
                PdfCanvas canvas = pdf.Pages[0].Canvas;

                PdfColorProfile colorProfile = pdf.AddColorProfile("Sample data/AdobeRGB1998.icc");
                canvas.Brush.Color = new PdfRgbColor(colorProfile, 20, 80, 240);
                canvas.DrawRectangle(new RectangleF(10, 50, 100, 70), PdfDrawMode.Fill);

                pdf.Save("ColorProfiles.pdf");
            }

            Process.Start("ColorProfiles.pdf");
        }
    }
}
VB
Imports System.Diagnostics
Imports System.Drawing

Imports BitMiracle.Docotic.Pdf

Namespace BitMiracle.Docotic.Pdf.Samples
    Public NotInheritable Class ColorProfiles
        Public Shared Sub Main()
            ' NOTE: 
            ' When used in trial mode, the library imposes some restrictions.
            ' Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            ' for more information.

            Using pdf As New PdfDocument()
                Dim canvas As PdfCanvas = Pdf.Pages(0).Canvas

                Dim colorProfile As PdfColorProfile = Pdf.AddColorProfile("Sample data/AdobeRGB1998.icc")
                canvas.Brush.Color = New PdfRgbColor(colorProfile, 20, 80, 240)
                canvas.DrawRectangle(New RectangleF(10, 50, 100, 70), PdfDrawMode.Fill)

                Pdf.Save("ColorProfiles.pdf")
            End Using

            Process.Start("ColorProfiles.pdf")
        End Sub
    End Class
End Namespace