drawLine method
Draws a line connecting the two points specified by the coordinate pairs.
//Create a new PDF document.
PdfDocument doc = PdfDocument()
..pages
.add()
.graphics
//Draw line.
.drawLine(PdfPens.black, Offset(100, 100), Offset(200, 100));
// Save the document.
List<int> bytes = doc.save();
// Dispose the document.
doc.dispose();
Implementation
void drawLine(PdfPen pen, Offset point1, Offset point2) {
_helper._beginMarkContent();
_helper._stateControl(pen, null, null, null);
_helper.streamWriter!.beginPath(point1.dx, point1.dy);
_helper.streamWriter!.appendLineSegment(point2.dx, point2.dy);
_helper.streamWriter!.strokePath();
_helper.endMarkContent();
(_helper._getResources!() as PdfResources)
.requireProcset(PdfDictionaryProperties.pdf);
}