我需要使用 显示PDF file
在我的组件上ng2-pdf-viewer
,但其中一项要求是,我需要添加button download
并且它必须重叠PDF file
,尝试查找有关此的任何参考,但没有找到,这是我尝试过的,
组件.html
<button (click)="toggle()">VIEW RECEIPT</button>
<div style="height:715px">
<pdf-viewer *ngIf="isHideReceipt" [autoresize]="true" [src]="pdfSrc" [original-size]="false"
[render-text]='false' [show-all]="false" style="display: block;position: relative"
[fit-to-page]="true">
</pdf-viewer>
<button (click)="download()">Download PDF</button>
</div>
组件.ts
pdfSrc = '../../assets/pdf/bla3.pdf';
toggle() {
this.isHideReceipt = !this.isHideReceipt;
}
download() {
const blob = this.pdfSrc;
saveAs(blob, 'test1.pdf');
}
根据要求(按钮下载重叠的pdf),我尝试使用CSS,z-index
但没有工作,有可能吗?