Skip to content

[Bug]: Text selection <span> positioning incorrect #20017

Open
@breadmin0213

Description

@breadmin0213

Attach (recommended) or Link to PDF file

compressed.tracemonkey-pldi-09 (1).pdf

Web browser and its version

크롬/사파리

Operating system and its version

window

PDF.js version

"pdfjs-dist": "^4.4.168",

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. load pdf
  2. select pdf

What is the expected behavior?

What went wrong?

Image

Image

I used the browser’s F12 developer tools to make all of the text black. From the screenshot, you can see that the text rendered on the canvas and the s in the text layer have the correct height but the wrong width. Because those spans are wider than the actual glyphs on the canvas, when I select text or use the search tool to highlight matches, the highlights appear in the wrong places—even over blank areas. The PDF in the image is the default PDF from https://mozilla.github.io/pdf.js/web/viewer.html. Is there any way to fix this?

Link to a viewer

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions