【发布时间】:2020-01-18 13:39:33
【问题描述】:
我需要使用ng2-pdf-viewer 在我的组件上显示PDF file,但其中一项要求是,我需要添加button download,并且它必须与PDF file 重叠,尝试查找有关此的任何参考,但没有找到,这是我尝试过的,
component.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>
component.ts
pdfSrc = '../../assets/pdf/bla3.pdf';
toggle() {
this.isHideReceipt = !this.isHideReceipt;
}
download() {
const blob = this.pdfSrc;
saveAs(blob, 'test1.pdf');
}
根据要求(按钮下载重叠的 pdf),我尝试使用 z-index 之类的 CSS,但没有用,有可能吗?
【问题讨论】:
-
it doesn't work是什么意思?是不是没有出现,是不是出现在了错误的地方?如果有的话,请发布您的其余 css 代码。 -
按钮下载不显示,不重叠
pdf file
标签: html css angular typescript pdf