question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Part of the Chinese character cannot be rendered

See original GitHub issue

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

Configuration:

  • Web browser and its version: chrome 86.0.4240.193
  • Operating system and its version: macOS 10.13.6
  • PDF.js version: 2.5.207
  • Is a browser extension: -

Steps to reproduce the problem:

  1. use the getDocument api to render the pdf
  2. getDocument options:
{  
    url: 'https://zhihu-live.zhimg.com/pdf/20201112/origin/ac8b5907e1cf5ee7cada8650bbf1082d.pdf' 
    cMapUrl: 'https://unpkg.com/browse/pdfjs-dist@2.6.347/cmaps/',
    cMapPacked: true
}

What is the expected behavior? (add screenshot) expect render normal

image What went wrong? (add screenshot) image

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): no

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
YeeJonecommented, Nov 16, 2020

I found a strange phenomenon: when cMapUrl is a CDN address, there will be problems, like this:

That suggests that the issue could be that the CDN is returning incorrect/malformed data, which we unfortunately cannot do anything about here since the CDN is provided by a third-party. Another possible explanation could be that you’re using a CORS policy which somehow breaks the CMap-requests, and in that case you could maybe try using a custom CMapReaderFactory to work-around that.

yep, I noticed that too
https://unpkg.com/browse/pdfjs-dist@2.6.347/cmaps/GBK-EUC-H.bcmap This url actually returned an HTML, not a bCmap resource… : )💥

So the solution is to replace cMapUrl with https://cdn.jsdelivr.net/npm/pdfjs-dist@2.5.207/cmaps/ Thank you very much for your help!!😁 😬

1reaction
Snuffleupaguscommented, Nov 16, 2020

I found a strange phenomenon: when cMapUrl is a CDN address, there will be problems, like this:

That suggests that the issue could be that the CDN is returning incorrect/malformed data, which we unfortunately cannot do anything about here since the CDN is provided by a third-party. Another possible explanation could be that you’re using a CORS policy which somehow breaks the CMap-requests, and in that case you could maybe try using a custom CMapReaderFactory to work-around that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chinese Fonts Rendering Problem on Windows 10 Pro (English)
In some places, the Chinese characters are not rendering correctly. For example, file names containing Chinese in the File Explorer, characters ...
Read more >
How to make sure Chinese text is rendered in webpage?
Your first Chinese word will be coded as 你好嗎 . These coded characters will show any browser, regardless of the encoding ...
Read more >
Chinese characters not being rendered on JSP - Stack Overflow
jsp through mainserverlet and in this case, it renders the "editable" text in chinese properly. The second case is when i change the...
Read more >
Inconsistent rendering of Chinese characters - Bugzilla@Mozilla
Expected results: Chinese characters should be should rendered in a uniform way. ... Why can't Firefox guess the best font to use if...
Read more >
Some Chinese characters are shown as not recognized when ...
How to reproduce: 1. Open attached project "UIElement_test.zip" 2. Open "SampleScene" scene 3. Enter Play Mode 4. Observe rendered c...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found