I've got an app which finds text in a PDF document, then tries to put an image over it.
While looking for the text, I'm finding the relevant operators/matrices. For an example document, I get:
Code:
0.75 0 0 -0.75 0 841.920044 cm
1 0 0 -1 49.119999 304.799988 Tm
But I've got issues positioning the image correctly from that.
From the calculation, it looks like I should be putting the image at {36.83999925,613.320053}
But PdfSharp does the positioning differently, so I'm not sure how to translate that.
I tried to apply the scale, translate, scale and use the original Tm numbers:
Code:
gfx.ScaleTransform(0.75, -0.75);
gfx.TranslateTransform(0, 841.920044);
gfx.ScaleTransform(1, -1);
gfx.DrawImage(
signatureImg,
signatureLocation.Value.X, signatureLocation.Value.Y,
90, 90 / signatureImg.PointWidth * signatureImg.PointHeight);
But that doesn't work quite the way I expected
How do I translate the cm/Tm numbers to DrawImage at the exact point?