小编Pra*_*aja的帖子

基于原生pdf坐标在pdfjs画布中突出显示区域

我正在使用 pdf.js 在浏览器中显示 pdf 文件。我想根据从 Nuance 的 OCR 获得的原生 pdf 坐标突出显示 pdf 中的某些区域。目前我正在绘制一个矩形(通过创建一个 div 并将其添加到父元素。)。然而,我绘制的矩形总是偏离预期位置。

Can somebody help me on how to transform the native pdf coordinates to the exact position on the canvas/viewport, so that I can place my div on the right position to highlight the correct area. 
Any help would be greatly appreciated.
The following is the code I am using to highlight:

function HiglightContent(page, viewport, canvas)
    {
        var pageNumber = 1;
        //native pdf coordinates from OCR …
Run Code Online (Sandbox Code Playgroud)

pdfjs

9
推荐指数
0
解决办法
1855
查看次数

标签 统计

pdfjs ×1