PdfGraphics class

Represents a graphics context of the objects.

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

Properties

clientSize Size
Gets the size of the canvas reduced by margins and page templates.
no setter
colorSpace PdfColorSpace
Gets or sets the current color space of the document.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Size
Gets the size of the canvas.
no setter

Methods

drawArc(Rect bounds, double startAngle, double sweepAngle, {PdfPen? pen}) → void
Draws an arc representing a portion of an ellipse specified by a Rect structure.
drawBezier(Offset startPoint, Offset firstControlPoint, Offset secondControlPoint, Offset endPoint, {PdfPen? pen}) → void
Draws a Bezier spline defined by four Offset structures.
drawEllipse(Rect bounds, {PdfPen? pen, PdfBrush? brush}) → void
Draws an ellipse specified by a bounding Rect structure.
drawImage(PdfImage image, Rect bounds) → void
Draws an image into PDF graphics.
drawLine(PdfPen pen, Offset point1, Offset point2) → void
Draws a line connecting the two points specified by the coordinate pairs.
drawPath(PdfPath path, {PdfPen? pen, PdfBrush? brush}) → void
Draws a GraphicsPath defined by a pen, a brush and path.
drawPdfTemplate(PdfTemplate template, Offset location, [Size? size]) → void
Draws a template at the specified location and size.
drawPie(Rect bounds, double startAngle, double sweepAngle, {PdfPen? pen, PdfBrush? brush}) → void
Draws a pie shape defined by an ellipse specified by a Rect structure uiand two radial lines.
drawPolygon(List<Offset> points, {PdfPen? pen, PdfBrush? brush}) → void
Draws a polygon defined by a brush, an array of Offset structures.
drawRectangle({PdfPen? pen, PdfBrush? brush, required Rect bounds}) → void
Draws a rectangle specified by a pen, a brush and a Rect structure.
drawString(String s, PdfFont font, {PdfPen? pen, PdfBrush? brush, Rect? bounds, PdfStringFormat? format}) → void
Draws the specified text string at the specified location.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restore([PdfGraphicsState? state]) → void
Restores the state of this Graphics to the state represented by a GraphicsState.
rotateTransform(double angle) → void
Applies the specified rotation to the transformation matrix of this Graphics.
save() PdfGraphicsState
Saves the current state of this Graphics and identifies the saved state with a GraphicsState.
setClip({Rect? bounds, PdfPath? path, PdfFillMode? mode}) → void
Sets the clipping region of this Graphics to the result of the specified operation combining the current clip region and the rectangle specified by a RectangleF structure.
setTransparency(double alpha, {double? alphaBrush, PdfBlendMode mode = PdfBlendMode.normal}) → void
Sets the transparency of this graphics.
skewTransform(double angleX, double angleY) → void
Skews the coordinate system axes.
toString() String
A string representation of this object.
inherited
translateTransform(double offsetX, double offsetY) → void
Changes the origin of the coordinate system by prepending the specified translation to the transformation matrix of this Graphics.

Operators

operator ==(Object other) bool
The equality operator.
inherited