【发布时间】:2021-09-29 05:52:32
【问题描述】:
我正在尝试将 Base64 中的字符串显示为 PDF 并在浏览器中下载它,当我发送拥有它的变量时,它不会在浏览器中显示。
app.component.html ->
<div class="modal-header">
<h3 style="font-size: 1.2em; color: #838181" class="modal-title" id="modal-title">
{{ terminosCondicionesModalSeguroVidaTitulo }}
</h3>
<button type="button" class="close" aria-describedby="modal-title" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<iframe width='100%' height='100%' src=''>{{SeguroVida}}</iframe>
</div>
<div class="modal-footer">
<input type="submit" class="btnGenericGreen next" (click)="Aprobar()"
value="{{ terminosCondicionesModalSeguroVidaBoton }}" />
</div>
app.component.ts ->
llenadoParametros() {
console.log(this.paramArray.find((x) => x.codigo === DocumentsAcceptation.SeguroVida) ? .valorAlfa || '');
this.SeguroVida = this.paramArray.find(
(x) => x.codigo === DocumentsAcceptation.SeguroVida
) ? .valorAlfa || '';
this.SeguroVida = this.sanitizer.bypassSecurityTrustUrl('data:application/pdf;base64,' + this.paramArray.find((x) => x.codigo === DocumentsAcceptation.SeguroVida) ? .valorAlfa || '');
}
我仍然不知道为什么它没有在浏览器中显示。我做错了什么?
【问题讨论】:
标签: html angular typescript pdf base64