rotateTransform method

void rotateTransform(
  1. double angle
)

Applies the specified rotation to the transformation matrix of this Graphics.

//Creates a new PDF document.
PdfDocument doc = PdfDocument();
//Adds a page to the PDF document.
doc.pages.add().graphics
  //Set rotate transform
  ..rotateTransform(-90)
  //Draws the text into PDF graphics in -90 degree rotation.
  ..drawString('Hello world.', PdfStandardFont(PdfFontFamily.courier, 14),
      bounds: Rect.fromLTWH(-100, 0, 200, 50));
//Saves the document.
List<int> bytes = doc.save();
//Dispose the document.
doc.dispose();

Implementation

void rotateTransform(double angle) {
  final PdfTransformationMatrix matrix = PdfTransformationMatrix();
  matrix.rotate(-angle);
  _helper.streamWriter!.modifyCurrentMatrix(matrix);
  _helper.matrix.multiply(matrix);
}