How do I enable ICC color management in PDFNet?

Q: How to enable ICC color management in PDFNet?
----

A:

To enable ICC color management call PDFNet.SetColorManagement(true) and
initialize default ICC color profiles (assumes PDFNet v.3.6 or above).
For example:

PDFNet.Initialize();
PDFNet.SetResourcesPath("C:/MyApp/resources");

// Optional: Set the default ICC color profiles for device color
spaces.
try {
  PDFNet.SetColorManagement(true);
  // Note: You can place the profile in the PDFNet resource folder,
  // or you can provide an explicit path.
  PDFNet.SetDefaultDeviceCMYKProfile("USWebCoatedSWOP.icc");
  PDFNet.SetDefaultDeviceRGBProfile("AdobeRGB1998.icc");
}
catch (Exception ex) {
  Console.WriteLine("The specified color profile was not found."); }

To download an entire sample illustrating the use of the new API,
please use the following link:
  www.pdftron.com/zPDFNET-35A58CO7-shoplocal/PDFDraw2Sample.zip

To download other standard color profiles used in Adobe products,
please use the following link:
  www.adobe.com/support/downloads/detail.jsp?ftpID=3145

You can then copy all *.icc files to the PDFNet resource folder (or to
some other location).

---
The entire sample code is as follows:

using System;
using System.Drawing;

using pdftron;
using pdftron.Common;
using pdftron.PDF;

namespace PDFDrawTestCS
{
  class PDFDrawTestCS
  {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    static void Main(string[] args)
    {
      // The first step in every application using PDFNet is to initialize
the
      // library and set the path to common PDF resources. The library is
usually
      // initialized only once, but calling Initialize() multiple times is
also fine.
      PDFNet.Initialize();
      PDFNet.SetResourcesPath("../../../../../resources");

      // Optional: Set the default ICC color profiles for device color
spaces.
      try
      {
        PDFNet.SetColorManagement(true);
        PDFNet.SetDefaultDeviceCMYKProfile("USWebCoatedSWOP.icc");
        PDFNet.SetDefaultDeviceRGBProfile("AdobeRGB1998.icc");
      }
      catch (Exception ex)
      {
        Console.WriteLine("The specified color profile was not found.");
      }

      // Relative path to the folder containing test files.
      string input_path = "../../../../TestFiles/";
      string output_path = "../../../../TestFiles/Output/";

      PDFDraw draw = new PDFDraw();

      try
      {
        PDFDoc doc = new PDFDoc("in.pdf");
        doc.InitSecurityHandler();
        draw.SetDPI(92);
        draw.Export(doc.PageBegin().Current(), "out.png");
      }
      catch (PDFNetException e) {
        Console.WriteLine(e.Message);
      }

      draw.Dispose(); // Explicitly clean-up allocated memory
      PDFNet.Terminate();
    }
  }
}