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();
double radians = Math.Atan2(mtx.m_c, mtx.m_a);
double angle = radians * (180/Math.PI);

Another possible solution is to transform a point on (0, 1) and
calculate the angle between the starting and the transformed point.

For other solutions please see http://www.mathworks.com/matlabcentral/newsreader/view_thread/160945
and http://en.wikipedia.org/wiki/Rotation_matrix.