Class PdfICCColorSpace
Represents an ICC based colorspace..
Inherited Members
Namespace: Syncfusion.Pdf.ColorSpace
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfICCColorSpace : PdfColorSpaces, IPdfCache, IPdfWrapper
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
// Read the ICC profile from disk.
FileStream fs = new FileStream("rgb.icc", FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fs.Length];
fs.Read(profileData, 0, profileData.Length);
fs.Close();
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
IccBasedCS.ProfileData = profileData;
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Read the ICC profile from disk.
Dim fs As FileStream = New FileStream("rgb.icc", FileMode.Open, FileAccess.Read)
Dim profileData() As Byte = New Byte(fs.Length - 1){}
fs.Read(profileData, 0, profileData.Length)
fs.Close()
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace()
calRgbCS.Gamma = New Double() { 7.6, 5.1, 8.5 }
' Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace()
IccBasedCS.ProfileData = profileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double() { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1 }
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")
Constructors
PdfICCColorSpace()
Initializes a new instance of the PdfICCColorSpace class.
Declaration
public PdfICCColorSpace()
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
// Read the ICC profile from disk.
FileStream fs = new FileStream("rgb.icc", FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fs.Length];
fs.Read(profileData, 0, profileData.Length);
fs.Close();
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
IccBasedCS.ProfileData = profileData;
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Read the ICC profile from disk.
Dim fs As FileStream = New FileStream("rgb.icc", FileMode.Open, FileAccess.Read)
Dim profileData() As Byte = New Byte(fs.Length - 1){}
fs.Read(profileData, 0, profileData.Length)
fs.Close()
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace()
calRgbCS.Gamma = New Double() { 7.6, 5.1, 8.5 }
' Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace()
IccBasedCS.ProfileData = profileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double() { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1 }
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")
See Also
Properties
AlternateColorSpace
Gets or sets the alternate color space.
Declaration
public PdfColorSpaces AlternateColorSpace { get; set; }
Property Value
Type | Description |
---|---|
PdfColorSpaces | The alternate color space to be used in case the one specified in the stream data is not supported. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
// Read the ICC profile from disk.
FileStream fs = new FileStream("rgb.icc", FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fs.Length];
fs.Read(profileData, 0, profileData.Length);
fs.Close();
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
IccBasedCS.ProfileData = profileData;
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Read the ICC profile from disk.
Dim fs As FileStream = New FileStream("rgb.icc", FileMode.Open, FileAccess.Read)
Dim profileData() As Byte = New Byte(fs.Length - 1){}
fs.Read(profileData, 0, profileData.Length)
fs.Close()
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace()
calRgbCS.Gamma = New Double() { 7.6, 5.1, 8.5 }
' Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace()
IccBasedCS.ProfileData = profileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double() { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1 }
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")
See Also
ColorComponents
Gets or sets the color components.
Declaration
public byte ColorComponents { get; set; }
Property Value
Type | Description |
---|---|
System.Byte | The number of color components in the color space described by the ICC profile data. |
Remarks
This number must match the number of components actually in the ICC profile. As of PDF 1.4, this value must be 1, 3 or 4.
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
// Read the ICC profile from disk.
FileStream fs = new FileStream("rgb.icc", FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fs.Length];
fs.Read(profileData, 0, profileData.Length);
fs.Close();
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
IccBasedCS.ProfileData = profileData;
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Read the ICC profile from disk.
Dim fs As FileStream = New FileStream("rgb.icc", FileMode.Open, FileAccess.Read)
Dim profileData() As Byte = New Byte(fs.Length - 1){}
fs.Read(profileData, 0, profileData.Length)
fs.Close()
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace()
calRgbCS.Gamma = New Double() { 7.6, 5.1, 8.5 }
' Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace()
IccBasedCS.ProfileData = profileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double() { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1 }
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")
See Also
ProfileData
Gets or sets the profile data.
Declaration
public byte[] ProfileData { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] | The ICC profile data. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
// Read the ICC profile from disk.
FileStream fs = new FileStream("rgb.icc", FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fs.Length];
fs.Read(profileData, 0, profileData.Length);
fs.Close();
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
IccBasedCS.ProfileData = profileData;
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Read the ICC profile from disk.
Dim fs As FileStream = New FileStream("rgb.icc", FileMode.Open, FileAccess.Read)
Dim profileData() As Byte = New Byte(fs.Length - 1){}
fs.Read(profileData, 0, profileData.Length)
fs.Close()
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace()
calRgbCS.Gamma = New Double() { 7.6, 5.1, 8.5 }
' Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace()
IccBasedCS.ProfileData = profileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double() { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1 }
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")
See Also
Range
Gets or sets the range for color components.
Declaration
public double[] Range { get; set; }
Property Value
Type | Description |
---|---|
System.Double[] | An array of 2 � ColorComponents numbers [ min0 max0 min1 max1 ... ] specifying the minimum and maximum valid values of the corresponding color components. These values must match the information in the ICC profile. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
// Read the ICC profile from disk.
FileStream fs = new FileStream("rgb.icc", FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fs.Length];
fs.Read(profileData, 0, profileData.Length);
fs.Close();
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
IccBasedCS.ProfileData = profileData;
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Read the ICC profile from disk.
Dim fs As FileStream = New FileStream("rgb.icc", FileMode.Open, FileAccess.Read)
Dim profileData() As Byte = New Byte(fs.Length - 1){}
fs.Read(profileData, 0, profileData.Length)
fs.Close()
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace()
calRgbCS.Gamma = New Double() { 7.6, 5.1, 8.5 }
' Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace()
IccBasedCS.ProfileData = profileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double() { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1 }
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")
See Also
Methods
GetProfileData()
Get the default Color Profile.
Declaration
public byte[] GetProfileData()
Returns
Type | Description |
---|---|
System.Byte[] | ICC profile data. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
//Create RGB color space.
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
//Set the default ICC profile data.
IccBasedCS.ProfileData = IccBasedCS.GetProfileData();
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
doc.Close(true);
'Creates a new document
Dim doc As PdfDocument = New PdfDocument
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = doc.Pages.Add
'Create RGB color space.
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace
calRgbCS.Gamma = New Double()
{ 7.6, 5.1, 8.5}
'Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace
'Set the default ICC profile data.
IccBasedCS.ProfileData = IccBasedCS.GetProfileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double()
{ 0, 1, 0, 1, 0, 1}
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1}
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")
doc.Close(True)
Save()
Saves an instance.
Declaration
protected void Save()