mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.36k stars 9.97k forks source link

Error in rendering Chinese character text annotation #16960

Closed yidu864 closed 1 year ago

yidu864 commented 1 year ago

Attach (recommended) or Link to PDF file here:

  1. origin pdf (generate from Microsoft® Word 2021): origin pdf
  2. origin pdf add text-annotation: pdf
  3. open prev pdf and edit text-annotation: pdf

Configuration:

Steps to reproduce the problem:

  1. Open the first named 'origin' pdf above, then add any Chinese character text-annotation and save as new pdf
  2. Open the new pdf saved in the first step, edit the existing Chinese character text-annotation (use any Chinese characters), and save as new pdf
  3. Open the pdf that saved in the secend step, you will see chinese character text-annotation will be rendering error

What is the expected behavior? (add screenshot) Correct rendering of Chinese character annotations, like expected What went wrong? (add screenshot) Rendering error after secondary editing of Chinese character text-annotation error render unexpected

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

None, I'm using pdf.js as a chrome extension, Use PDF Viewer to open the above pdf file link to see the results

Others:

  1. This exception does not only appear in the PDF files I provided. It seems that this error will occur in any PDF after executing the above steps to reproduce the problem.
  2. Files that use PDF Viewer to add Chinese character annotation are abnormal when opened in other PDF viewers (e.g: Chrome built-in, Adobe-Acrobat). Chinese character annotation will be missing, and the behavior is as follows chrome-built-in adobe-acrobat
Snuffleupagus commented 1 year ago

Duplicate of #15769