How do I convert PDF page points to screen points using the CTM?

Q: I am having trouble using the CTM. How do I convert PDF page points
to screen points using the ctm and not convPagePTtoScreenPT method ? I
need to use CTM for some transformations but not able to get screen
position correctly with CTM and element.matrix
----
A: You can use Mult/multPoint method in Matrix2D class. For example:

// In C#/VB.Net
Matrix2D ctm = element.GetCTM();
Matrix2D dev_mtx = new Matrix2D(scale_x, 0, 0, slale_y, translate_x,
translate_y); Matrix2D mtx = dev_mtx * ctm; mtx.Mult(ref x, ref y);

Alternatively you could convert Matrix2D to a matrix class that you
are more familiar with and then transform the points using the new
class.

// In Java:
Matrix2D ctm = element.getCTM();
Matrix2D dev_mtx = new Matrix2D(scale_x, 0, 0, slale_y, translate_x,
translate_y); Matrix2D mtx = dev_mtx.multiply(ctm);

java.awt.geom.Point2D.Double t=mtx.multPoint(x, y); x=t.x; y=t.y;
System.out.println(" Position: x=" + x + " y=" + y );

// In C++
Matrix2D ctm = element.GetCTM();
Matrix2D dev_mtx (scale_x, 0, 0, slale_y, translate_x, translate_y);
Matrix2D mtx = dev_mtx * ctm; mtx.Mult(x, y);