Hi,
In my application in angular 6, I am showing Data(Report) in new window as follows.
- *** result contains Base64 data***
-
- 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>")
Now what I want to do is like, I want to embed this data(result) in my angular component in <iframe> or <embed> tag.
My html code is as follows
- <iframe [src]="PathReportString"></iframe>
and component.ts code is
- this.PathReportString = (this.sanitizer.bypassSecurityTrustResourceUrl(result) as any).changingThisBreaksApplicationSecurity;
But it shows error "unsafe value used in a resource URL context"
How to embed data to component. Also my data is base64.
What is going wrong? Any help would be appreciated. Thank you.