我正在尝试预览pdf,正在使用引导模态,但出现以下错误:
无法初始化查看器TypeError:无法读取未定义的属性'div'
当我调用模态时,pdf不会显示在模态中,但是如果我从左到右移动滚动条,那么我可以在模态中看到pdf。有人遇到过同样的问题吗?最好的解决方案是什么?
<div class="modal fade" id="preview{{f.id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">{{ f.name }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div *ngIf="this['sourceIMG' + f.id]!=null">
<img class="img-fluid d-block mx-auto" [src]="this['sourceIMG' + f.id]" />
</div>
<pdf-viewer [src]="this['sourcePDF' + f.id]"
[render-text]="true" [page]="page"
[show-all]="true" style="display:block">
</pdf-viewer>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>