How to Embed PDF file using HTML?

Embed PDF file using HTML document is a simple process. First, you need to get the URL for the PDF file, which can be found by right-clicking the file and selecting “Copy Link Location”. Once you have the URL, add an <embed> tag to the HTML document, with the src attribute set to the URL. The other two attributes, width and height, can be set to any values you want, but usually should be set to the same size as the PDF file. Finally, you can add additional attributes to further customize the embedded PDF.
You can use the <embed> tag to embed a PDF file in an HTML page. The src attribute of the <embed> tag should contain the URL of the PDF file.
Here’s an example:
1 |
<embed src="/path/to/your/pdf.pdf" width="600" height="800"> |
This will embed a PDF file in the HTML page and display it at a width of 600 pixels and a height of 800 pixels.
You can also use the <object> tag to embed a PDF file in an HTML page. The data attribute of the <object> tag should contain the URL of the PDF file.
Here’s an example:
1 2 3 |
<object data="/path/to/your/pdf.pdf" type="application/pdf" width="600" height="800"> <p>Your browser does not support PDFs. Please download the PDF to view it: <a href="/path/to/your/pdf.pdf">Download PDF</a>.</p> </object> |
This will also embed the PDF file in the HTML page and display it at a width of 600 pixels and a height of 800 pixels. If the browser does not support PDF files, the text inside the <object> tag will be displayed instead.
Conclusion:
Using HTML to embed a PDF file is a simple and straightforward process. All that is required is an HTML tag containing the URL of the PDF file. Once the tag is added, the PDF file will be displayed in the browser window. This is an ideal way to share documents with a wide audience, as the PDF file can be accessed from anywhere and displayed on any device.
Mraj
Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts. If you have any questions let me drop an email with the article name to the following email id: [email protected]