colorSpace property

PdfColorSpace colorSpace
getter/setter pair

Gets or sets the current color space of the document.

//Creates a new PDF document.
PdfDocument doc = PdfDocument();
//Create PDF graphics for the page
doc.pages.add().graphics
  ..colorSpace = PdfColorSpace.grayScale
  ..drawRectangle(
      brush: PdfBrushes.red, bounds: Rect.fromLTWH(0, 0, 515, 762));
//Saves the document.
List<int> bytes = doc.save();
//Dispose the document.
doc.dispose();

Implementation

late PdfColorSpace colorSpace;