PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Skew Text
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4761
Page 1 of 1

Author:  zzp3ng [ Wed Jan 08, 2025 9:04 pm ]
Post subject:  Skew Text

I have been working on converting a program from Python to C# using PDFSharp, and this library has made it easy.
However, I have been attempting to create a method to skew text. Basically, I want to slant the text by a given angle, such as 45 degrees.

Is there a function that allows this? It was straightforward in Python using the FPDF library, which has a .skew method as follows:

with pdfdoc.skew(angle, 0):
pdfdoc.text(text=stemp, x=xp, y=yp)

Alternatively, can I access the graphics matrix? When using an old version of itextsharp (version 5), I could access the textmatrix and provide the appropriate adjustment where skewing you just applied TAN(angle) to the matrix.

[1 tan a tan b 1 0 0]

where a = angle of rise, b = angle of slope off vertical

Any help would be appreciated.
Thanks
Paul.

Author:  zzp3ng [ Wed Jan 08, 2025 9:40 pm ]
Post subject:  Re: Skew Text

Doh!....

Seems I missed the SkewAtTransform function ...

Just had to troll the library a bit more.

/Paul

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/