如何在角度6组件中嵌入数据PDF Base 64

问题描述

在角度6的应用程序中,我在新窗口中显示Data(Report),如下所示。 ***结果包含Base64数据***

if (result != null) {    
          const pdfWindow = window.open("");    
          pdfWindow.document.write("<html<head><title>Pathology Report</title><style>body{margin: 0px;}iframe{border-width: 0px;}</style></head>");    
          pdfWindow.document.write("<body><embed width='100%' height='100%' src='data:application/pdf;base64," +    
              encodeURI(result) + "#toolbar=0&navpanes=0&scrollbar=0'></embed></body></html>")   

现在我想做的是,我想将此数据(结果)嵌入标签中的角度组件中。 我的html代码如下

<iframe [src]="PathReportString"></iframe>  

和component.ts代码是

this.PathReportString = (this.sanitizer.bypassSecurityTrustResourceUrl(result) as any).changingThisBreaksApplicationSecurity;  

但是它显示错误“在资源URL上下文中使用了不安全的值”。 结果将正确显示在新窗口中,但尝试嵌入时会显示错误。 如何嵌入数据。我的数据也是base64。
怎么了?任何帮助,将不胜感激。谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)