Marcelh1983 / angular-document-viewer

MIT License
62 stars 23 forks source link

Google Viewer doesn't always load file #45

Closed avoThomas closed 4 years ago

avoThomas commented 4 years ago

When using the Google viewer to try and load a file, it doesn't always render the file first time or after a few tries. Whats confusing is that the loaded event is emitted from the doc viewer even though I still can't see the document.

The viewer has been implemented as follows:

<ngx-doc-viewer
  id="doc-viewer"
  *ngIf="doc | async"
  url="{{resumeURL}}"
  viewer="google"
  class="doc-viewer"
  (loaded)="resumeLoaded()"
  [hidden]="loadingSubject | async"
  [queryParams]="getLanguage()"
  googleCheckContentLoaded="true">
</ngx-doc-viewer>

And then the following is output to my console: The top iframe is when it loads correctly and the bottom iframe is when it doesn't load correctly. consoleoutput

We would use the office viewer as we want to display docx/doc files, but that has a cookies banner at the top.

giovannidias1 commented 4 years ago

+1

Marcelh1983 commented 4 years ago

Hi @avoThomas ,

The google viewer has some issues with first time loading. I don't exactly know why and whats the real problem. I implemented the reload function because of this and made this work-around configurable by be able to disable this reloading and configuring your own interval.

Could you clone this repository and set your document url in demo application. Maybe you'll find the problem and make a PR 😄. If you have an example of a document that has this problem, you can send me the url and I can do some tests in the weekend as well.

Marcelh1983 commented 4 years ago

Hi @avoThomas, @kaleu50 I tried several documents on the internet to try to reproduce your problem. I couldn't reproduce. Is there a way I can test with the document you are using? Or do you have Stackblitz or something were I can reproduce the problem?