PdfPen.fromBrush constructor

PdfPen.fromBrush(
  1. PdfBrush brush, {
  2. double width = 1.0,
  3. PdfDashStyle dashStyle = PdfDashStyle.solid,
  4. PdfLineCap lineCap = PdfLineCap.flat,
  5. PdfLineJoin lineJoin = PdfLineJoin.miter,
})

Initializes a new instance of the PdfPen with PdfBrush.

//Create a new PDF document.
PdfDocument doc = PdfDocument()
  ..pages.add().graphics.drawRectangle(
      //Create a new PDF pen instance.
      pen: PdfPen.fromBrush(PdfBrushes.red),
      bounds: Rect.fromLTWH(0, 0, 200, 100));
//Save the document.
List<int> bytes = doc.save();
//Close the document.
doc.dispose();

Implementation

PdfPen.fromBrush(PdfBrush brush,
    {double width = 1.0,
    PdfDashStyle dashStyle = PdfDashStyle.solid,
    PdfLineCap lineCap = PdfLineCap.flat,
    PdfLineJoin lineJoin = PdfLineJoin.miter}) {
  _helper = PdfPenHelper(this);
  _setBrush(brush);
  _width = width;
  _initialize(width, dashStyle, lineCap, lineJoin);
}