Open FrancescoBorzi opened 2 months ago
Without an error of some kind or at least more debugging I’m not sure there’s much to do here or how to help.
The package isn’t generally broken so it seems like you need to do more work locating the issue. Is the viewer loading but somehow not visible? Is something about the way you implemented it making the component invisible (eg height 0)? Etc
Agree it’s unexpected between versions. This being FOSS, the onus is much more on you as the developer…
Confirmed this issue. Haven't been able to look into the cause yet but downgrading to 10.2.2 does resolve.
With respect, “me too” isn’t that helpful either. Again, it doesn’t seem to affect most…
Without an error of some kind or at least more debugging I’m not sure there’s much to do here or how to help.
The package isn’t generally broken so it seems like you need to do more work locating the issue. Is the viewer loading but somehow not visible? Is something about the way you implemented it making the component invisible (eg height 0)? Etc
Agree it’s unexpected between versions. This being FOSS, the onus is much more on you as the developer…
@shamoon I totally agree. I've just couldn't have the chance to investigate more on this. Reporting the issue is already a good start to track the problem and give others the possibility to confirm it and add more details.
With respect, “me too” isn’t that helpful either. Again, it doesn’t seem to affect most…
@shamoon I disagree on that. Of course, more details would be ideal, but even just knowing that other users are experiencing the same issue is already a small piece of useful information. So thanks @studioromeo for confirming.
Yea I dont want to get into a tit-for-tat and distract here but I'll just say that without an actual error or specific description there is no real certainty that you are actually experiencing the same issue.
Anyway, we'll see. If I can help I'll be happy too
there is no real certainty that you are actually experiencing the same issue.
well, there is no 100% certainty but I'm 99% sure, given that:
downgrading to 10.2.2 does resolve
for both it works fine on 10.2.2 and it doesn't work after that.
Hi @Francesco-Borzi
Are you using pdfWorkerSrc
by any chance? I can see that the file names have changed from pdf.worker.js
to pdf.worker.mjs
(and min files change similarly).
In my test project appears to be the cause of the failure that resolves when downgrading to 10.2.2. Correcting the path to use the .mjs
extension resolves on 10.3.x
The docs still references .js files so I have raised a PR to to avoid potential confusion https://github.com/VadimDez/ng2-pdf-viewer/pull/1134
It's worth considering a major release as while this is a breaking change in a child dependency, and this projects API has not been affected directly, it does expose the global pdf.js API and therefore represents a significant risk to consumers.
Thanks!
Not sure the problem I experienced was the same, but at least it it turned out ng2-pdf-viewer works fine for me. PDFs were not displayed:
The console said:
pdf-preview.component.ts:33[Image Preview]: Error occured Error: Setting up fake worker failed: "Failed to fetch dynamically imported module: http://localhost:2362/microcore/cpaval/ui/pdf.worker.js".
at pdf.mjs:12000:36
at _ZoneDelegate.invoke (zone.js:368:26)
at Object.onInvoke (core.mjs:11083:33)
at _ZoneDelegate.invoke (zone.js:367:52)
at Zone.run (zone.js:129:43)
at zone.js:1257:36
at _ZoneDelegate.invokeTask (zone.js:402:31)
at core.mjs:10757:55
at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:10757:36)
at _ZoneDelegate.invokeTask (zone.js:401:60)
Turned out I had this line in my main.ts
:
(window as any).pdfWorkerSrc = '/rootpath/ui/pdf.worker.js';
Changing it to
(window as any).pdfWorkerSrc = '/rootpath/ui/pdf.worker.mjs';
Solved the issue.
Bug Report or Feature Request (mark with an
x
)We have been using version
10.2.2
and it worked fine:Since version
10.3.0
it is broken (we tried also10.3.1
, same result). The component simply does not show up anymore, without any meaningful error:We also noticed that internally the component changed the dependency version of
pdfjs-dist
from3.x
to4.x
, which might be the cause of the issue.This was the change that broke it on our app: