| Viewed 68 times

how to view pdf in html


how to view pdf in html

1 Answer
Mikdam Qandeel
Answered
3

There is such a way to view pdf file in HTML, first of all, you can embed them using <embed> tag.

For example, if you have a pdf file its name is QandeelPDF.pdf, and it's inside a folder called files, so you will add it like this:

Example:

<embed src="files/QandeelPDF.pdf" type="application/pdf" width="100%" height="600px" />

You have some attributes you can add like:

  • src: Defines the path of the QandeelPDF.pdf  file to embed.
  • type: Definesthe media type of QandeelPDF.pdf.
  • width: Defines the width of QandeelPDF.pdf.
  • height: Defines the height QandeelPDF.pdf.

Another way is by using <object> tag.

Example:

<object data="../files/QandeelPDF.pdf" type="application/pdf" width="100%" height="600px"></object>