当尝试获取渲染的pdf中元素的坐标时,测量完全关闭。 They seem to be shifted and scaled down by some factor
该功能如下所示:
function getCenterCoordinates(element) {
const fullY = Math.round((element.getBoundingClientRect().top + (element.getBoundingClientRect().height / 2)) * 10 ) / 10;
// fullY = fullY % 1046.838;
return {
// x: Math.round((element.getBoundingClientRect().left + (element.getBoundingClientRect().width / 2)) * 10 ) / 10,
x: element.getBoundingClientRect().left,
y: fullY
}
}
我也尝试过使用offsetLeft,但没有运气。
欢迎任何解决问题的帮助!