I am trying to display a PDF using a amazon s3 signed url that i got as a response from backend java api service. How can i preview the pdf in a modal instead of downloading it using angular 6?
While using this url as a src in iframe, it downloads the file to browser.
previewProtocol(){
this.service.getPreviewUrl(userId).subscribe((response) => {
$('#pdfModal').modal("show");
let url = response;
this.pdfUrl = this.domSanitizer.bypassSecurityTrustResourceUrl(url);
},
(err)=> {
});
}
<iframe style="height:500px;width:100%;" [src]="pdfUrl"></iframe>
Trying to maintain the look of the viewer like that of a browser, hence using iframe.