0

How can i serve files of different format(pdf,xlsx,doc) stored in a AWS s3 bucket to a HTML page with iframe. I am able to get pdf file but other type of files just downloads in the browser instead of displaying.

To render the pdf file, I am first converting the content to a blob and passing it to src of iframe as below,

<div>
   <iframe className="w-screen h-screen" src={file} />
</div>
VinayGowda
  • 155
  • 2
  • 12

1 Answers1

0

That is not possible without providing a viewer for these filetypes.

The reason the pdf file is displayed, is because most modern web browsers contain a pdf viewer by default.

Take a look at this similar question: How do I render a Word document (.doc, .docx) in the browser using JavaScript?

E13
  • 443
  • 5
  • 12