Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF Display Issue Due to adjustMapping Function #18117

Closed
ren1244 opened this issue May 20, 2024 · 0 comments · Fixed by #18119
Closed

PDF Display Issue Due to adjustMapping Function #18117

ren1244 opened this issue May 20, 2024 · 0 comments · Fixed by #18119
Assignees

Comments

@ren1244
Copy link

ren1244 commented May 20, 2024

I have a PDF whose charstrings are encoded in UTF-8, and it uses Unicode characters beyond 0xFFFF. This PDF displays correctly in both Chrome and Adobe Reader DC, but it does not display correctly in Firefox.

Upon reviewing the code, I found an issue in the adjustMapping function at line 488 in the src/core/fonts.js file:

originalCharCode |= 0;

If originalCharCode is greater than 2147483647, this will cause it to become a negative value, resulting in an error. Commenting out this line allows the PDF to display correctly.

Since I am not fully familiar with the details, I am just submitting an issue here.

Attach (recommended) or Link to PDF file here: document.pdf

Configuration:

  • Web browser and its version: FireFox 126.0
  • Operating system and its version: Windows 11
  • PDF.js version: 63b66b4

Steps to reproduce the problem:

  1. Clone this repository
  2. Open web/viewer.html
  3. Open the pdf

What is the expected behavior? (add screenshot)
圖片

What went wrong? (add screenshot)
圖片

@ren1244 ren1244 changed the title Gatting negitve originalCharCode in function adjustMapping PDF Display Issue Due to adjustMapping Function May 20, 2024
@Snuffleupagus Snuffleupagus self-assigned this May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants