Table of Contents

Class PdfIndexedColorSpace

Namespace
Syncfusion.Pdf.ColorSpace
Assembly
Syncfusion.Pdf.Portable.dll

Represents an indexed colorspace.

public class PdfIndexedColorSpace : PdfColorSpaces
Inheritance
PdfIndexedColorSpace
Inherited Members

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();
// Creates indexed color space
PdfIndexedColorSpace colorspace = new PdfIndexedColorSpace();
colorspace.BaseColorSpace = new PdfDeviceColorSpace(PdfColorSpace.RGB);
colorspace.MaxColorIndex = 3;
colorspace.IndexedColorTable = new byte[] { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 };
// Creates index color
PdfIndexedColor color = new PdfIndexedColor(colorspace);
color.SelectColorIndex = 3;
RectangleF rect = new RectangleF(20, 70, 200, 100);
PdfPen pen = new PdfPen(color);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("IndexedColor.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Creates indexed color space
Dim colorspace As PdfIndexedColorSpace = New PdfIndexedColorSpace()
colorspace.BaseColorSpace = New PdfDeviceColorSpace(PdfColorSpace.RGB)
colorspace.MaxColorIndex = 3
colorspace.IndexedColorTable = New Byte() { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 }
' Creates index color
Dim color As PdfIndexedColor = New PdfIndexedColor(colorspace)
color.SelectColorIndex = 3
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
Dim pen As PdfPen = New PdfPen(color)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("IndexedColor.pdf")

Constructors

PdfIndexedColorSpace()

Initializes a new instance of the PdfIndexedColorSpace class.

public PdfIndexedColorSpace()

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();
// Creates indexed color space
PdfIndexedColorSpace colorspace = new PdfIndexedColorSpace();
colorspace.BaseColorSpace = new PdfDeviceColorSpace(PdfColorSpace.RGB);
colorspace.MaxColorIndex = 3;
colorspace.IndexedColorTable = new byte[] { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 };
// Creates index color
PdfIndexedColor color = new PdfIndexedColor(colorspace);
color.SelectColorIndex = 3;
RectangleF rect = new RectangleF(20, 70, 200, 100);
PdfPen pen = new PdfPen(color);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("IndexedColor.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Creates indexed color space
Dim colorspace As PdfIndexedColorSpace = New PdfIndexedColorSpace()
colorspace.BaseColorSpace = New PdfDeviceColorSpace(PdfColorSpace.RGB)
colorspace.MaxColorIndex = 3
colorspace.IndexedColorTable = New Byte() { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 }
' Creates index color
Dim color As PdfIndexedColor = New PdfIndexedColor(colorspace)
color.SelectColorIndex = 3
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
Dim pen As PdfPen = New PdfPen(color)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("IndexedColor.pdf")
See Also

Properties

BaseColorSpace

Gets or sets the base colorspace.

public PdfColorSpaces BaseColorSpace { get; set; }

Property Value

PdfColorSpaces

The color space in which the values in the color table are to be interpreted.

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();
// Creates indexed color space
PdfIndexedColorSpace colorspace = new PdfIndexedColorSpace();
colorspace.BaseColorSpace = new PdfDeviceColorSpace(PdfColorSpace.RGB);
colorspace.MaxColorIndex = 3;
colorspace.IndexedColorTable = new byte[] { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 };
// Creates index color
PdfIndexedColor color = new PdfIndexedColor(colorspace);
color.SelectColorIndex = 3;
RectangleF rect = new RectangleF(20, 70, 200, 100);
PdfPen pen = new PdfPen(color);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("IndexedColor.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Creates indexed color space
Dim colorspace As PdfIndexedColorSpace = New PdfIndexedColorSpace()
colorspace.BaseColorSpace = New PdfDeviceColorSpace(PdfColorSpace.RGB)
colorspace.MaxColorIndex = 3
colorspace.IndexedColorTable = New Byte() { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 }
' Creates index color
Dim color As PdfIndexedColor = New PdfIndexedColor(colorspace)
color.SelectColorIndex = 3
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
Dim pen As PdfPen = New PdfPen(color)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("IndexedColor.pdf")
See Also

IndexedColorTable

Gets or sets the color table.

public byte[] IndexedColorTable { get; set; }

Property Value

byte[]

The table of color components.

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();
// Creates indexed color space
PdfIndexedColorSpace colorspace = new PdfIndexedColorSpace();
colorspace.BaseColorSpace = new PdfDeviceColorSpace(PdfColorSpace.RGB);
colorspace.MaxColorIndex = 3;
colorspace.IndexedColorTable = new byte[] { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 };
// Creates index color
PdfIndexedColor color = new PdfIndexedColor(colorspace);
color.SelectColorIndex = 3;
RectangleF rect = new RectangleF(20, 70, 200, 100);
PdfPen pen = new PdfPen(color);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("IndexedColor.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Creates indexed color space
Dim colorspace As PdfIndexedColorSpace = New PdfIndexedColorSpace()
colorspace.BaseColorSpace = New PdfDeviceColorSpace(PdfColorSpace.RGB)
colorspace.MaxColorIndex = 3
colorspace.IndexedColorTable = New Byte() { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 }
' Creates index color
Dim color As PdfIndexedColor = New PdfIndexedColor(colorspace)
color.SelectColorIndex = 3
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
Dim pen As PdfPen = New PdfPen(color)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("IndexedColor.pdf")

Remarks

The color table data must be m * (maxIndex + 1) bytes long, where m is the number of color components in the base color space. Each byte is an unsigned integer in the range 0 to 255 that is scaled to the range of the corresponding color component in the base color space; that is, 0 corresponds to the minimum value in the range for that component, and 255 corresponds to the maximum.

See Also

MaxColorIndex

Gets or sets the index of the max color.

public int MaxColorIndex { get; set; }

Property Value

int

The maximum index that can be used to access the values in the color table.

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();
// Creates indexed color space
PdfIndexedColorSpace colorspace = new PdfIndexedColorSpace();
colorspace.BaseColorSpace = new PdfDeviceColorSpace(PdfColorSpace.RGB);
colorspace.MaxColorIndex = 3;
colorspace.IndexedColorTable = new byte[] { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 };
// Creates index color
PdfIndexedColor color = new PdfIndexedColor(colorspace);
color.SelectColorIndex = 3;
RectangleF rect = new RectangleF(20, 70, 200, 100);
PdfPen pen = new PdfPen(color);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("IndexedColor.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Creates indexed color space
Dim colorspace As PdfIndexedColorSpace = New PdfIndexedColorSpace()
colorspace.BaseColorSpace = New PdfDeviceColorSpace(PdfColorSpace.RGB)
colorspace.MaxColorIndex = 3
colorspace.IndexedColorTable = New Byte() { 150, 0, 222, 255, 0, 0, 0, 255, 0, 0, 0, 255 }
' Creates index color
Dim color As PdfIndexedColor = New PdfIndexedColor(colorspace)
color.SelectColorIndex = 3
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
Dim pen As PdfPen = New PdfPen(color)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("IndexedColor.pdf")
See Also

Methods

GetProfileData()

Gets the profile data.

public byte[] GetProfileData()

Returns

byte[]

The profile data.

See Also

Save()

Saves an instance.

protected void Save()
See Also

See Also