PDF Mosaic: How to load an ICC profile into PDF document


Home       Features       Download       License       Tutorial       Version History       Source Code

 

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, PDF Mosaic library can also use colors with associated color profiles.


 

C# :

using PDFMosaic;
using System.Drawing;
using System;
 
namespace ColorProfiles
{
  class ColorProfiles
  {
    static void Main()
    {
      PDFDocument document = new PDFDocument();
      document.Pages.Add(new PDFPage(PDFPaperFormat.A4));
      PDFCanvas canvas = document.Pages[0].Canvas;
 
      PDFICCBased icc = new PDFICCBased("..\\..\\ColorMatchRGB.icc");
 
      PDFColorICC colorICC = new PDFColorICC(icc, new PDFColorRGB(0, 255, 0));
      PDFColorGray colorGray = new PDFColorGray(123);
 
      PDFSolidBrush brushICC = new PDFSolidBrush(colorICC);
      PDFSolidPen penGray = new PDFSolidPen(colorGray, 10);
 
      canvas.DrawEllipse(penGray, brushICC, 100, 100, 70, 100);
 
      document.Save("ColorAndProfiles.pdf", true);
    }
  }
}

 

Visial Basic.NET :

Imports PDFMosaic
Imports System.Drawing
Imports System
 
Module ColorProfiles
  Sub Main()
    Dim document As PDFDocument = New PDFDocument()
    document.Pages.Add(New PDFPage(PDFPaperFormat.A4))
    Dim canvas As PDFCanvas = document.Pages(0).Canvas
 
    Dim icc As PDFICCBased = New PDFICCBased("..\\..\\ColorMatchRGB.icc")
 
    Dim colorICC As PDFColorICC = New PDFColorICC(icc, New PDFColorRGB(0, 255, 0))
    Dim colorGray As PDFColorGray = New PDFColorGray(123)
 
    Dim brushICC As PDFSolidBrush = New PDFSolidBrush(colorICC)
    Dim penGray As PDFSolidPen = New PDFSolidPen(colorGray, 10)
 
    canvas.DrawEllipse(penGray, brushICC, 100, 100, 70, 100)
 
    document.Save("ColorProfiles.pdf", True)
  End Sub
End Module

 


Home       Features       Download       License       Tutorial       Version History       Source Code