#1 2023-06-28 22:13:51

surfzone
Member
Registered: 2023-06-25
Posts: 7

How can I write 90º rotated text with the TPDFCanvas?

I think that I need to use PDF.Canvas.SetTextMatrix, but I cannot find any example to show how it works...

Anyone can put an example?

Thanks!

Offline

#2 2023-06-30 09:29:19

surfzone
Member
Registered: 2023-06-25
Posts: 7

Re: How can I write 90º rotated text with the TPDFCanvas?

Finally, I found how works...

  var a := angle*(PI/180);
  var c := Cos(a);
  var s := Sin(a);
  pdf.Canvas.SetFont('Arial', 11, []);
  pdf.Canvas.BeginText;
  pdf.Canvas.SetTextMatrix(c, s, -s, c, 200, 200);
  pdf.Canvas.ShowText('ROTATED TEXT');
  pdf.Canvas.EndText;

Only works with ShowText (with TextOut not).

And BeginText, EndText is important too

Offline

Board footer

Powered by FluxBB