ng2-pdf-Viewer does not display automatic pdf

Asked

Viewed 56 times

0

I have an Angular 8 application that I get a pdf file from the API. At the angle, I get the pdf file as blob and convert to Filereader to use the byte array. I am facing the following problem, the pdf only appears on the screen when I click on the page or roll the screen. I have tested several properties of ng2-pdf-viewr and nothing worked. I want the pdf to appear on the screen as soon as it is loaded, without clicking or scrolling the screen. Can someone help me with this problem?

Component.html:

<pdf-viewer 
    [src]="fileReader.result" 
    style="display: block;">
</pdf-viewer>

Component.:

private actionsForSuccessDownloadFile(data: any, tipo: string) {
   this.blob = new Blob([data], { type: tipo });

   // Blob -> ArrayBuffer
   this.fileReader.readAsArrayBuffer(this.blob);
   this.loading = false; 
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.