Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting window.webViewerLoad is not a function #20

Closed
premzetwerk opened this issue Dec 11, 2018 · 35 comments

Comments

Projects
None yet
@premzetwerk
Copy link

commented Dec 11, 2018

No description provided.

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Dec 11, 2018

Would you mind to add some detail?

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Dec 13, 2018

Closed because I can't see how to reproduce the bug. The PDF viewer works in my project, and AFAIK many other projects, too. So it can't be a general problem.

@Hasan-git

This comment has been minimized.

Copy link

commented Jan 16, 2019

same as here

@Hasan-git

This comment has been minimized.

Copy link

commented Jan 17, 2019

Stephan I need your help please I have the same issue

https://stackblitz.com/edit/angular-vsrmnd

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Jan 17, 2019

@Hasan-git Thanks for the Stackblitz demo! Maybe I can help you now.

But it may take a while. I'm moving to another town. That's a lot of work, so I barely manage to read my mails. Please keep pinging me. In two or three weeks I should be able to return to my open-source projects again.

@stephanrauh stephanrauh reopened this Jan 17, 2019

@avarndell

This comment has been minimized.

Copy link

commented Jan 24, 2019

I have the same issue as Hasan-git.

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Jan 24, 2019

@avarndell Duly noted. The incident made it to the top of my priority list. Well, almost to the top, I'm still in the midst of moving, but it's a close second!

@stephanrauh stephanrauh self-assigned this Jan 24, 2019

@stephanrauh stephanrauh added the bug label Jan 24, 2019

@Findelias

This comment has been minimized.

Copy link

commented Feb 12, 2019

Same here.

And add another one in the same row.

Cannot read property 'open' of undefined

@JWess

This comment has been minimized.

Copy link

commented Feb 14, 2019

Same issue.

@JWess JWess referenced this issue Feb 14, 2019

Closed

Package size? #37

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Feb 14, 2019

Sorry for letting you guys down. Moving to another town is a lot of work! I plan to resume work on ngx-pdf-viewer soon.

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Feb 21, 2019

I've downloaded your project to my local IDE, and it shows a different error. That's a pity, because I'd like to reproduce and solve the original error.

However, what you can do is to add [delayFirstView]="250" (or a bigger number). The error message you've reported often indicated timing problems.

@premzetwerk @Hasan-git @avarndell @Findelias @JWess Can you test this and tell me if it solves the bug, please? Thanks in advance!

If it doesn't: please open the file node_modules/ngx-extended-pdf-viewer/assets/viewer.js, search for window.webViewerLoad (line 259 or so) and add a console.log("Initialized webViewerLoad"); statement. Does you application print this statement? If so, is it printed before or after the error message?

@Findelias

This comment has been minimized.

Copy link

commented Feb 22, 2019

Hi

I had the delayFirstView but without [], I added it but dont work... I put the console.log but its not printed anywhere. So I'm in the same place. @stephanrauh

Thanks for all anyway!

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Feb 22, 2019

So I'm in the same place.

Well, not quite. Granted, your bug still exists. But this sort of tedious, boring work is the key to success. I have to admit I'm still puzzled. Even so, now I know that there's something preventing the viewer.js file from being loaded. Either that, or it's loaded too late. So now we can start examining why that's so.

@Findelias

This comment has been minimized.

Copy link

commented Feb 22, 2019

Well dont worry. Im going to wrap your library and try to fix it too. Maybe together we can found the fix.

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Mar 17, 2019

There seems to be a problem with Stackblitz. It doesn't support loading extra files using the angular.json file. I've also failed to load the three JS files directly.

So the reproducer isn't really a reproducer. It just shows what happens with an unmodified angular.json.

(To be fair: Stackblitz is awesome. Expecting it to parse the angular.json configuration is expecting too much. It's just a pity that we can't reproduce the bug this way).

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Mar 19, 2019

@Findelias Is there any progress on your side?

@Findelias

This comment has been minimized.

Copy link

commented Mar 21, 2019

@Findelias Is there any progress on your side?

No, sorry. But I was busy the last days.

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Mar 21, 2019

Same here. :( It's a bit tiresome to hunt down these strange bugs. Finding race conditions in minified code... there has to be a better way! Does anybody know how to compile Mozilla's PDF.js without minification?

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Apr 4, 2019

@Findelias Ping! :)

(In other words: I'd like to repeat my question if there's progress on your side?)

@3m0

This comment has been minimized.

Copy link

commented Apr 9, 2019

Had the same issue, turns out I had to add useBrowserLocale to the tag and configure delayFirstView to 1000. Everything loads fine then...

@asilvapino

This comment has been minimized.

Copy link

commented May 6, 2019

guys, i made a mistake putting this settings on the TEST section:

Open the file "angular.json" (or ".angular-cli.json" if you're using an older version of Angular) and add these three JavaScript files to the "scripts" section:

"scripts": [
  "node_modules/ngx-extended-pdf-viewer/assets/pdf.js",
  "node_modules/ngx-extended-pdf-viewer/assets/pdf.worker.js",
  "node_modules/ngx-extended-pdf-viewer/assets/viewer.js"
]

Add the translations to the assets by adding them to the "assets" section in the angular.json:

"assets": [
  "src/favicon.ico",
  "src/assets",
  {
    "glob": "**/*",
    "input": "node_modules/ngx-extended-pdf-viewer/assets/locale",
    "output": "/assets/locale/"
  }
]

So, you make sure to put this settings on "architect": section.
Regards

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented May 6, 2019

I suspect most of these issues have something to do with these settings. I'll create a showcase web page with demo projects and documentation - maybe that helps. However, it may take a while.

@oskarhelling

This comment has been minimized.

Copy link

commented May 6, 2019

I had the same problem as described above, and managed to solve it by moving the viewer scripts first in the scripts list in angular.json.

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented May 6, 2019

@oskarhelling Now that's interesting. I still don't understand what's going on, but it sounds like a clue. Can you send me a reproducer? One that shows the error if the viewer scripts are put last, but doesn't if the viewer scripts are put first in the angular.json?

@oskarhelling

This comment has been minimized.

Copy link

commented May 6, 2019

@stephanrauh Unfortunately, I do not seem to be able to reproduce the issue anymore by changing the order back. It must have been a problem with cashed files or something. The only other thing I did was to delete my entire output directory at the same time that I was "desperately" tweaking the project to see if I can provoke any kind of "reaction". Then it just suddenly started working. Apologies for the false positive.

@asilvapino

This comment has been minimized.

Copy link

commented May 6, 2019

errorPdf
errorPdfConsole

in yellow, where it should be...

@Jch71

This comment has been minimized.

Copy link

commented May 23, 2019

Moving the scripts first in the scripts list was the solution for me, thanks !

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Jun 1, 2019

@asilvapino I tried to reproduce your idea. However, moving the assets section below the scripts section doesn't make any difference. Tested with Angular 8.0.0.

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Jun 1, 2019

I've collected your hints at http://pdfviewer.net/troubleshooting. Thanks everybody for participating in this discussion! I believe your clues helped many developers to get <ngx-extended-pdf-viewer> up and running.

@stephanrauh stephanrauh closed this Jun 1, 2019

@raovikash

This comment has been minimized.

Copy link

commented Jun 9, 2019

errorPdf
errorPdfConsole

in yellow, where it should be...

In directory node_modules/ngx-extended-pdf-viewer/assets/ check if the name of files are same with which you are referring them in scripts. In my case, I had to replace "node_modules/ngx-extended-pdf-viewer/assets/pdf-2.2.199.worker.js" with "node_modules/ngx-extended-pdf-viewer/assets/pdf.worker-2.2.199.js".

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Jun 9, 2019

Oops. I have to do that. Would you mind to copy your text to a new issue? This helps me to track of the open issues. This one is close, so I might forget it.

Thanks in advance,
Stephan

@raovikash

This comment has been minimized.

Copy link

commented Jun 9, 2019

No problem, please go ahead.

@StevenGarcia-CG

This comment has been minimized.

Copy link

commented Jul 11, 2019

Same issue here, with angular.json as in examples and delayfirstView="6000"

EDIT: New tip: after installing, restart project, changes to angular.json won't be picked up if not

@jiverson

This comment has been minimized.

Copy link

commented Jul 11, 2019

Fyi the current iteration of this issue is because of angular cli v8 angular/angular-cli#14952. It will work if you use ng build instead of ng serve because the scripts tag do not have type="module" in the production build (as per the defect).

You can could also update to the latest version of the cli to fix it via npm install @angular/cli@next for the time being.

Edit: Sorry I linked the wrong issue. I updated it. And here is the fix per the PR angular/angular-cli@67cd378

@stephanrauh

This comment has been minimized.

Copy link
Owner

commented Jul 11, 2019

Hold my beer. Adding a web worker does that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.