Open PDF within an Iframe

In this article, we discuss How to Embed PDF in Website Using HTML. In HTML there are 3 ways to embed PDF in HTML.

How to Embed PDF in Website Using HTML

3 Ways to Embed PDF in Website using HTML

  1. By using object <object> tag.
  2. Using embed <embed> tag.
  3. Using iframe <iframe> tag

Embed PDF using iframe in HTML

To embed pdf in web page we can use iframe tag, where you can set height and width of the PDF.

HTML tag has some attributes which are used to manage and used to show PDF in HTML iframe. Attributes are explained below,

  • src – here you can set the path of the external file to embed.
  • type – here you can set the media type of the embedded content.
  • width – here you can specify the width of the embedded content.
  • height – here you can set the height of the embedded content.

Syntax of HTML PDF embed using <embed> tag

PDF embed code

Using HTML object PDF embed operation,

Above we do the PDF embed operation using different tags of HTML.

Note:
Using embed and object tag is old-fashioned and also considered deprecated.

So, we use a iframe to embed PDF in web page, which is an easy way to do the same.

I hope, I cleared all the things about How to display PDF in an HTML website using an iframe HTML tag.

If you guys facing any issue on this please let me know on comments.

On Medium: https://medium.com/@phpcodertech/3-ways-to-embed-pdf-in-website-using-html-d3cddff696be?sk=2db1b98c8e1021d884cb637de068c2df

Also Check:

Happy Coding..!

Was this article helpful?
YesNo

By Bikash

My name is Bikash Kr. Panda. I own and operate PHPCODER.TECH. I am a web Programmer by profession and working on more than 50 projects to date. Currently I am working on the web-based project and all the CMS and frameworks which are based on PHP.

16 thoughts on “How to Embed PDF in Website Using HTML”

Leave a Reply

Your email address will not be published. Required fields are marked *