# How to I obtain text element rotation angle?

Q: I have a PDF file wich has a rotated text (for example on 90
degree). Could you please tell me how I can calculate the rotation
angle in degree at runtime?

A: This information is stored in the product of current transformation
matrix and the text matrix:

Matrix2D mtx = element.GetCTM() * element.GetTextMatrix();

For a PDF matrix of the form Matrix2D(a,-b, b, a, c, d), where a and b
are not both zero, the rotation angle is atan2(b,a). If a PDF matrix
represents a rotation, then it will necessarily be of this form.

Matrix2D mtx = element.GetCTM() * element.GetTextMatrix();