The issue is with the extraction of text font and style upon text selection

I am currently facing with Advanced text extraction from a page region. Specifically, I am attempting to extract text font and style upon text selection, but I have encountered a problem with the y-coordinates of the selected text.
To provide some context, I am passing the coordinates of a rectangle (x1, y1, x2, y2) upon the completion of text selection. While the x-coordinates appear to be correct, the y-coordinates are offset, and the offset varies for different text selections.
I would greatly appreciate any guidance or suggestions you may have on how to resolve this issue.



Hello,

Thank you for contacting us about WebViewer and for providing sample code. The issue seems to be you are using the low level PDFNet SDK to extract text data. The low level PDFNet SDK matches our other desktop SDK and will have the X,Y coordinates start in the bottom left (so 0,0 is the bottom left). This matches how the coordinates in XFDF is stored

The WebViewer API (the one “documentViewer” is using) has coordinates start in the top left (so 0, 0 start in the top left corner). This matches how coordinates works in the browser environment

You can find out more about how coordinates work in the following guide. We have
Link

Please let me know if the above was helpful or if you want me to clarify something

Best Regards,

Andrew Yip
Web Developer
Apryse