Cannot open attached pdf file - TypeError: Cannot read properties of null (reading 'appendChild')
See original GitHub issuePDF attached here: SampleWithIssue12.7.pdf
Configuration:
- Web browser and its version: Chrome, Version 106.0.5249.119 (Official Build) (64-bit)
- Operating system and its version: Windows 10 Pro Version 21H2 OS Build 19044.2130
- PDF.js version: Tested on 2.11.338 and then upgraded to 2.14.305, having the same problem.
- Invoking the library via https://github.com/VadimDez/ng2-pdf-viewer
Steps to reproduce the problem:
- Open the attached pdf using pdf.js in the Chrome browser
- It crashed with this error in the console:
Error captured: Error: Uncaught (in promise): TypeError: Cannot read properties of null (reading 'appendChild')
TypeError: Cannot read properties of null (reading 'appendChild')
at TextLayerRenderTask._processItems (pdf.js:22212:20)
at pdf.js:22317:20
at _ZoneDelegate.invoke (zone.js:372:1)
at Object.onInvoke (core.mjs:25608:1)
at _ZoneDelegate.invoke (zone.js:371:1)
at Zone.run (zone.js:134:1)
at zone.js:1275:1
at _ZoneDelegate.invokeTask (zone.js:406:1)
at Object.onInvokeTask (core.mjs:25595:1)
at _ZoneDelegate.invokeTask (zone.js:405:1)
at resolvePromise (zone.js:1211:1)
at zone.js:1282:1
at _ZoneDelegate.invokeTask (zone.js:406:1)
at Object.onInvokeTask (core.mjs:25595:1)
at _ZoneDelegate.invokeTask (zone.js:405:1)
at Zone.runTask (zone.js:178:1)
at drainMicroTaskQueue (zone.js:585:1)
What is the expected behavior?
It should open the pdf file.
What went wrong?
What have I tried/analysis?
I used Nitro PDF and edited the text “Louise Anne Farrar” and changed it slightly. When I saved the PDF and opened it again in PDF.js, it worked. I noticed that the Helvetica font, which has Actual font ArialMT, was now embedded in the document (when I look at the pdf properties). Leads me to suspect that it is related to the embedding of the ArialMT Font, which the original PDF does not appear to have. It’s just a suspicion, don’t know if that is the actual issue though.
In addition, I tried to disable RenderTextMode, and that also solves the issue, the pdf will then display properly. But I don’t like this solution because the text is not selectable!!
Any ideas/suggestions?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Already noticed that, patch incoming 😃
Thank you, I’m only these older versions because thats the dependancy from the library that I am actually using in my Angular project:
I will see if the author over there will move to the latest, or at least supported versions of pdf.js.
Cheers!