'pdf.js text layer position accuracy

I'm using pdf.js and RecogitoJS to build a PDF annotation interface. This seems to work fairly ok. Except there's a small offset between the rendered canvas image and the hidden text layer that's used for selection underneath.

It's probably less than 2 chars in all cases, but it still leads users to make incorrect selections in many cases. I assume browser characteristics, system font size, as well as fonts used in the PDF may play a role, and perfect alignment is impossible. But if anyone has experienced this, and can give advice on tweaking the alignment between canvas and image layer, do let me know.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source