ng2-pdf-viewer not working properly in modal

This is code inside bootstrap4 modal box.
<div class=“modal-body”>
<span *ngIf = “showPdf ;then C1 else C2”>
<pdf-viewer [src]= pdfSrc
[original-size]=“false”
(after-load-complete)=“afterLoadComplete($event)”
style=“display: block;”
></pdf-viewer>
<ng-template #C1>
<div class=“spinner-grow text-primary”></div>
</ng-template>
</div>

This code is not working as expected. Pdf is not loading until inspect element option is opened.

(You might get an answer here, but because this forum is focused on npm, you might want to ask your question somewhere that targets experts with your package. I have moved your topic to #community:javascript)