Ngx-extended-pdf-viewer: Error when destroying component

Created on 13 Apr 2020  路  3Comments  路  Source: stephanrauh/ngx-extended-pdf-viewer

Check this first

Describe the bug
A clear and concise description of what the bug is.

When destroying component that is using the ngx-extended-pdf-viewer I am getting the following error:

this.document.removeElement is not a function at DynamicCssComponent.ngOnDestroy.

This seems to keep the pdf-viewer in memory, so the next time i load the viewer up i am receiving the error that 2 pdf viewers exist.

Version info

  • Version of ngx-extended-pdf-viewer 3.0.0
  • Version of the JavaScript files pdf.js, pdf-worker.js and viewer.js (currently: default files vs. version 2.2 preview files) default

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows 10 64 bit.
  • Browser [e.g. chrome, safari] Edge Chromium, Google Chrome, Mozilla Firefox
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

To Reproduce
Can you provide a reproducer? That's a small and simple but complete project demonstrating the bug.

Otherwise, please tell me how to reproduce the behavior:

  1. Implement a ngx-extended-pdf-viewer within a component.
  2. You can either toggle the component to render or place an if statement on the selector for the pdf-viewer itself.
  3. Toggle the viewer with a button to remove it from the DOM. The error will pop when its trying to be destroyed.

Demo PDF file
Many errors happen with specific PDF files only. So please add a PDF file (after checking the copyright of the PDF file first!)
I have tested with multiple PDF files, the same issue exists.

Screenshots
If applicable, add screenshots to help explain your problem.

Here is the error log I am getting from the console:
image

Additional context
Add any other context about the problem here.

This was not an issue with previous releases, it may be tied to something new in pdf.js.

Confirmed Solved bug

Most helpful comment

Weird bug. No idea how it slipped my testing. Be that as it may, your bugfix has landed with version 3.0.1.

Enjoy!
Stephan

All 3 comments

Just implemented this component 20 minutes ago and I'm getting it when navigating away from page component that this is implemented in.

Oops. That's an unexpected bug, and it doesn't look good. I'm putting it top on my list.

Weird bug. No idea how it slipped my testing. Be that as it may, your bugfix has landed with version 3.0.1.

Enjoy!
Stephan

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RahmatAliMalik5 picture RahmatAliMalik5  路  7Comments

DHalilovic picture DHalilovic  路  6Comments

Prasanth-FrontendDeveloper picture Prasanth-FrontendDeveloper  路  7Comments

dheerajm91 picture dheerajm91  路  3Comments

Dev-Akshay-Shelke picture Dev-Akshay-Shelke  路  10Comments