You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text layer is calculating the width very far off. When I open this PDF in VScode it tells me there are unsupported unicode characters, which doesn't happen for other PDFs that display correctly, so I am thinking this is part of the issue
Link to a viewer
No response
Additional context
I am using react-pdf, which uses pdfjs.
I have already raised this issue in react-pdf repo but I believe it is an issue with pdfjs and how it calculates the transform: scaleX of the span
This issue is occurring when multiple pages are displayed inside one document, will not happen on the first page, but if I displayed the first page twice it will occur.
I understand you would ideally want this fully reproduced in pdfjs, but I'm not sure how to do that, so any guidance would be appreciated
The text was updated successfully, but these errors were encountered:
I can't tell you what's wrong but one reason which could explain your issue is that the font used in the canvas used to measure the text is not the same as the one used in the text layer.
You can check the font used for the canvas in devtools:
WFM, when testing in Firefox Nightly 131.0a1 with its built-in PDF Viewer (i.e. PDF.js 4.5.195 [a372bf8]) on Windows 11.
This is how the textLayer renders there, with the relevant debug-mode enabled:
Attach (recommended) or Link to PDF file
apl_23_003.pdf
PDF is above. I had this issue using react-pdf, cross posting for more context
wojtekmaj/react-pdf#1848
Web browser and its version
Chrome Version 127.0.6533.90
Operating system and its version
Windows 10
PDF.js version
pdfjs-dist/build/pdf.worker.min.mjs
Is the bug present in the latest PDF.js version?
Yes
Is a browser extension
No
Steps to reproduce the problem
I am using react-pdf, but I believe this is an issue with pdfjs, I am not sure how to recreate this using pdfjs alone, so forgive me there.
What is the expected behavior?
The text layer should be displaying correctly
What went wrong?
The text layer is calculating the width very far off. When I open this PDF in VScode it tells me there are unsupported unicode characters, which doesn't happen for other PDFs that display correctly, so I am thinking this is part of the issue
Link to a viewer
No response
Additional context
I am using react-pdf, which uses pdfjs.
I have already raised this issue in react-pdf repo but I believe it is an issue with pdfjs and how it calculates the transform: scaleX of the span
pdf.js/src/display/text_layer.js
Line 419 in 300e806
This issue is occurring when multiple pages are displayed inside one document, will not happen on the first page, but if I displayed the first page twice it will occur.
I understand you would ideally want this fully reproduced in pdfjs, but I'm not sure how to do that, so any guidance would be appreciated
The text was updated successfully, but these errors were encountered: