Web Developer

There are several ways to include a PDF file in your HTML document: Using the <embed> and <object> tags, which are considered to be old-fashioned ways, because they are deprecated now. And Using the <a> or the <iframe> tag.

The easiest way to put PDF in an HTML document is using the <a> tag with its href attribute. You need to add the URL or the reference link of your PDF file to the element. Your code will look like the following.

<!DOCTYPE html>
<html>
  <head>
    <title>Title of Page</title>
  </head>
  <body>
    <h1>PDF</h1>
    <a href="file.pdf">Open a PDF file</a>
  </body>
</html>

Example of adding a PDF file to the HTML by using the <iframe> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of Page</title>
  </head>
  <body>
    <h1>PDF with iframe</h1>
    <iframe src="file.pdf" width="100%" height="200px">
    </iframe>
  </body>
</html>