Type Default Value Read Only Description

[Visual Basic]
 XRendering.ColorSpaceType.Rgb No The name of the output color space.




The name of the output color space.

The XRendering.ColorSpaceType enumeration may take the following values:

  • Rgb - red, green and blue
  • Gray - grayscale
  • Cmyk - cyan, magenta, yellow and black
  • Lab - a device independent color space
  • Indexed - indexed RGB; see the PaletteSize property

The following table shows the supported color spaces of each output format:

Output format RGB Gray CMYK Lab Indexed
PSD (Photoshop)          
JP2 (JPEG 2000)          
JPG         *
GIF and PNG        

*  The JPEG file format itself does not support indexed colors. Using JPG as an output format with the Indexed color space will result in a JPEG output with the number of colors as specified in PaletteSize, but the color profile will still be RGB. This is what you would expect if you created an Indexed PNG and then converted it to a JPEG file.

Why is my ColorSpace a string?

In older versions of ABCpdf the ColorSpace property was a string. So you might find code of this form.

theDoc.Rendering.ColorSpace = "CMYK"

In Version 8 the ColorSpace property was changed to a true enumeration. This is a safer way of coding as it allows the compiler to ensure that the values you are using are valid. Your new code should look like this.

theDoc.Rendering.ColorSpace = XRendering.ColorSpaceType.Cmyk

The names of the items in the XRendering.ColorSpaceType enumeration are the same as the values of the strings used in previous versions. So changing your code should be a simple search and replace operation.

Note that the enumeration is the XRendering.ColorSpace indicating the output color space for rendering. There is a different ColorSpace enumeration used for the content of objects inside a PDF document. The two are not the same.

Alternatively if you need to convert between enumerations and strings automatically you can do so. To convert from a string to an enumeration use the following code.

XRendering.ColorSpaceType csType = (XRendering.ColorSpaceType)Enum.Parse(typeof(XRendering.ColorSpaceType), csString, true)

To convert from an enumeration to a string use the following code.

string csString = csType.ToString("G")




The following example shows the effect that this parameter has on PDF rendering.

Doc theDoc = new Doc();
theDoc.Rect.String = theDoc.MediaBox.String;
// Render document in Gray colorspace
theDoc.Rendering.ColorSpace = "Gray";
theDoc.Rendering.DotsPerInch = 36;

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Rect.String = theDoc.MediaBox.String
' Render document in Gray colorspace
theDoc.Rendering.ColorSpace = "Gray"
theDoc.Rendering.DotsPerInch = 36