Hello Alex,
im really sorry, but it just doesn't work out. It's really confusing with all those different points and rectangles (tagPoint, PXC_Point, _POINTL, and so on...) I can't seem to find the right coordinate for the top left corner. I understand the example and i understand how it should work - but it just does not. So, right now im debugging the whole proccess.
Let me try to explain as much as possible. I am getting a rectangle with:
Code: Select all
var rect = pdfCtl.Doc.ActiveView.PagesView.Layout.GetPageRect(0);
//Coordinates are:
bottom: 937
left: 5
right: 665
top: 5
Based on that, i create a point in 5/5, which does not pass the HitTest. If i test 6/6, the HitTest passes, so i can assume that this are the coordinates of one of the corners in the page.
Next step, after i get that point in the page, which is (0 ; 727) (both values rounded
down) i calculate my rectangle in which i place the annotation (in this case a custom stamp) with this code:
Code: Select all
PXC_Rect pRect = new PXC_Rect
{
bottom = ptPagePoint.y - height, // height is 300 in my case
left = ptPagePoint.x,
right = ptPagePoint.x + width, // width is 300 in my case
top = ptPagePoint.y
};
This results in following coordinates (all values rounded
down again):
Code: Select all
bottom = 427,
left = 0,
right = 300,
top = 727
So, it is somehow in the top left corner (but with about a 1/5 of the page as distance). What really is weird to me, if i would double my width and height, my annotation should double in size. It indeed does, BUT its position changes diagonally and is now rather lower right from the center... And this just feels wrong to me.
Kind regards,
Dennis