How do I get path data (points) in the PDF coordinate system?

Q: I am trying to create code that will determine if a text element is
visible or not and so far it's going alright. Problem I have is that
in some cases the PDF uses a path consisting of a move followed by
three line to commands to create a path (rectangle). Now when I look
at those values, the move to always start at 0, 0. Are move to and
line to commands relative to the bounding box of the element (unlike
rectangle command that seems to work
fine)? Or is there another transform I have to apply?

I need to solve this rather quickly, I have tried looking on the net
and in your forums, but I guess since you provide a draw function, the
sample code on how to draw a PDF has been removed. That code of course
would have helped me a lot to understand how elements are placed on
top of each other etc.
-----
A: You would need to transform all the path points using the Current
Transformation Matrix (CTM).

You can obtain the CTM (Current Transformation Matrix) as follows:

pdftron.Common.Matrix2D ctm = element.GetCTM();

You can transform each point as follows:

In C# / VB.NET
ctm.Mult(ref x, ref y);

in C/C++
ctm.Mult(x, y);

For an example of how to access path data, please see ElementReaderAdv
sample project (http://www.pdftron.com/net/
samplecode.html#ElementReaderAdv).

Thanks. I got it in the end. After I sent the e-mail it hit me like a
Duh moment. O well. :slight_smile: Actually, I convert all the PDF coordinates to
my own coordinate system. So I found out I have to apply the default
page matrix, then the element CTM and in the case of text, the text
matrix to get all the values to come out correctly. Think I have it
working now, that is until something does not work and I find out
there is another case I don't know about. :wink: