What is the recommended way to embed PDF in HTML?

Problem:

You want to embed a PDF file on your html page. And you’re looking for the best way to do that.

Solution:

The best way of embedding a PDF file is to use the <object> tag.

The code:

<object data="abc.pdf" width="300px" height="600px" type="application/pdf"></object>

Explanation:

Object tag is used for embedding multimedia like audio, video, Java applets, ActiveX, PDF, and Flash etc in your webpage. There are other ways to embed (like <embed>, <iframe>), but <object> is currently standard way to embed PDF.

Leave a Reply

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