Enum PdfColorSpace
- Namespace
- Syncfusion.Pdf.Graphics
- Assembly
- Syncfusion.Pdf.Portable.dll
Defines set of color spaces.
public enum PdfColorSpace
Fields
CMYK = 1
CMYK color space.
GrayScale = 2
GrayScale color space.
Indexed = 3
Indexed color space used internally.
RGB = 0
RGB color space.
Examples
// Create a PDF Document.
PdfDocument doc = new PdfDocument();
//Add pages to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create PDF font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Regular);
//Set the color space.
graphics.ColorSpace = PdfColorSpace.GrayScale;
//Get the graphics client size.
SizeF clientSize = graphics.ClientSize;
//Draw rectangle to PDF graphics.
graphics.DrawRectangle(PdfBrushes.Red, new RectangleF(PointF.Empty, clientSize));
//Save the document
doc.Save("Output.pdf");
//Close the document
doc.Close(true);
' Create a PDF Document.
Dim doc As New PdfDocument()
'Add pages to the document
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create PDF font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Regular)
'Set the color space.
graphics.ColorSpace = PdfColorSpace.GrayScale
'Get the graphics client size.
Dim clientSize As SizeF = graphics.ClientSize
'Draw rectangle to PDF graphics.
graphics.DrawRectangle(PdfBrushes.Red, New RectangleF(PointF.Empty, clientSize))
'Save the document
doc.Save("Output.pdf")
'Close the document
doc.Close(True)