PdfPen constructor

PdfPen(
  1. PdfColor pdfColor,
  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 class.

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

Implementation

PdfPen(PdfColor pdfColor,
    {double width = 1.0,
    PdfDashStyle dashStyle = PdfDashStyle.solid,
    PdfLineCap lineCap = PdfLineCap.flat,
    PdfLineJoin lineJoin = PdfLineJoin.miter}) {
  _helper = PdfPenHelper(this);
  _color = pdfColor;
  _initialize(width, dashStyle, lineCap, lineJoin);
}