UWP

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfIndexedColorSpace

    Show / Hide Table of Contents

    Class PdfIndexedColorSpace

    Represents an indexed colorspace.

    Inheritance
    System.Object
    PdfColorSpaces
    PdfIndexedColorSpace
    Implements
    IPdfWrapper
    Inherited Members
    PdfColorSpaces.s_syncObject
    PdfColorSpaces.IPdfWrapper.Element
    Namespace: Syncfusion.Pdf.ColorSpace
    Assembly: Syncfusion.Pdf.UWP.dll
    Syntax
    public class PdfIndexedColorSpace : PdfColorSpaces, IPdfWrapper, IPdfCache
    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.

    Declaration
    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
    PdfIndexedColor
    PdfDeviceColorSpace
    PdfPen
    PdfColorSpaces

    Properties

    BaseColorSpace

    Gets or sets the base colorspace.

    Declaration
    public PdfColorSpaces BaseColorSpace { get; set; }
    Property Value
    Type Description
    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
    PdfIndexedColor
    PdfDeviceColorSpace
    PdfPen
    PdfColorSpaces

    IndexedColorTable

    Gets or sets the color table.

    Declaration
    public byte[] IndexedColorTable { get; set; }
    Property Value
    Type Description
    System.Byte[]

    The table of color components.

    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.

    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
    PdfIndexedColor
    PdfDeviceColorSpace
    PdfPen
    PdfColorSpaces

    MaxColorIndex

    Gets or sets the index of the max color.

    Declaration
    public int MaxColorIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    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
    PdfIndexedColor
    PdfDeviceColorSpace
    PdfPen
    PdfColorSpaces

    Methods

    GetProfileData()

    Gets the profile data.

    Declaration
    public byte[] GetProfileData()
    Returns
    Type Description
    System.Byte[]

    The profile data.

    Save()

    Saves an instance.

    Declaration
    protected void Save()

    Implements

    IPdfWrapper

    Extension Methods

    DateTimeExtension.ToDateTime(Object)

    See Also

    PdfColorSpaces
    PdfIndexedColor
    PdfDeviceColorSpace
    PdfPen
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved