Terminate worker in pdfjs and ng2-pdf-viewer

169 views Asked by At

i am implementing a small app with ionic angular. One part of this app is to upload, show and read out pdf files.

So step by step

  1. The user is on page upload-file and can upload a file
  2. If file is uploaded and the src property is set to something like https://restOfUrl. The ui on the same page changes and ng2-pdf-viewer element is set
  3. The user clicks on a button (read pdf) and the pdf should be parsed via pdfjs getDocument function
  4. The user clicks on save to save the pdf and its contents in a database

Now the user should be able to upload a second pdf the same way like the steps above but the pdf is not shown and somehow pdfjs is stuck at setting up a fake worker so step 3 is not executed anymore. I also tried setting the workerSrc property by my own. I have no error message in my console. I just saw that a worker is existing in my network tab when i try to upload the second pdf.

I am using angular 13 ng2-pdf-viewer 9.1.3 pdfjs-dist 3.1.81

If you guys need more information please let me know.

I tried some settings in angular json asset section I tried setting the workerSrc property by my own I tried setting the workerSrc property to null and undefined afterwards

0

There are 0 answers