X and y coordinates of the text using itextsharp

When I extract text using itextsharp, I get the x and y coordinates of the text. Using these 2 coordinates, if I convert text from pdf to html based on xy position at text position position. to get the x, y coordinates that I used

  • Vector curBaseline = renderInfo.GetBaseline (). GetStartPoint ();

  • float x = curBaseline [Vector.I1];

  • float y = curBaseline [Vector.I2];

    for example: when I extract text using the above method, say x = 42 and y = 659;

    "<span style = left: {0} px; bottom: {1} px; position: relative; \"> ", curBaseline [Vector.I1], curBaseline [Vector.I2]), position changes. can you help me set the default text position in pdf format.

+4
source share
1 answer

Posted as an answer ...

If I remember correctly, PDF uses a coordinate system that starts in the left corner of the BOTTOM page, and not at the top. Therefore, each coordinator is mistaken when you use it directly in html. You will need to convert the values.

Your pdf document should have something like document.actualheight, just subtract your value from this ....

+4
source

All Articles