0

Using Angular 6, I am making a API call to get the path of the pdf file in S3 bucket. Using this i need to display the PDF. But instead it is downloading the PDF to local client machine.

Currently i am appending the url returned by the API to an iframe.

public showPDFPreviewModal(pdfSrcUrl){
    this.display = 'block';
    $('#pdfView').attr('src',pdfSrcUrl);
  };

    <iframe  id="pdfView" width="1100" height="500"> </iframe>

How can i preview the pdf without downloading the file?

UI Dev
  • 167
  • 1
  • 4
  • 13

1 Answers1

0

You can use object tag to show PDF document on web page like below.

<object width="610" height="740" data="...PDF file url.."></object>

For more information check this out: https://www.w3schools.com/tags/tag_object.asp.

Hope it helps.

varun
  • 300
  • 4
  • 10