1

Im trying to view a pdf file using html. But whenever i try to open it, the browser download the file instead of viewing it.. I dont know whats wrong. I tried embed and iframe and both results the same thing. It downloads the file. Thing is when i see other websites, it works. so i know for sure its not because extension problems. checked the pdf viewer extension and its on. Here is my code. how is this happening??

<div class="row">
          <div class="col-sm">
            <p><span class="fw-bold">DOKUMEN : </span></p>
            <iframe src="http://127.0.0.1:8000/docs/testpdf.pdf" width="100%" height="100%" style="border: none;"></iframe>
            <embed src="http://127.0.0.1:8000/docs/testpdf.pdf" type="application/pdf" width="100%" height="600px" />

          </div>
        </div>

1 Answers1

1

Some browsers like IE dosent have the proper plug-in to render embedded PDF. You better work with browsers like firefox or chrome. Here is a page that answered your question before. downloading PDF embedded file instead of viewing it

Ozone
  • 11
  • 4