How to Embed PDF Document in HTML Web Page

Generally, a hyperlink is used to link a PDF document to display in the browser. An HTML anchor link is the easiest way to display a PDF file. But if you want to display a PDF document on the web page, PDF file needs to be embedded in HTML. The HTML < embed >tag is the best option to embed PDF document on the web page. In this tutorial, we will show you how to display PDF file in the web page using HTML < embed >tag.

The HTML < embed >tag defines a container to load external content in the web page. The following parameters can be specified in the < embed >tag.

Embed PDF File in HTML

Use the following code to embed the PDF file in the HTML web page.

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

PDF Document View Configuration

Now we will show how you can control the PDF document view on the web page. Using parameters in the URL, you can specify exactly what to display and how to display PDF documents.
The following parameters are commonly used to embed PDF files in HTML or open in the browser.

Specifying Parameters in URL

You can specify multiple parameters in the URL. Each parameter should be separated with either an ampersand ( & ) or a pound ( # ) character. Actions are executed from left to right and later actions will override the previous actions.

http://example.com/doc.pdf#Chapter5 http://example.com/doc.pdf#page=5 http://example.com/doc.pdf#page=3&zoom=200,250,100 http://example.com/doc.pdf#zoom=100 http://example.com/doc.pdf#page=72&view=fitH,100

Disable and Hide Toolbar in PDF Web Viewer

This example shows how to hide or remove the toolbar, navpanes, and scrollbar of the PDF file opened in HTML < embed >using parameters in URL.

Use the following code to embed PDF document in the web page and remove or hide the toolbar of embedded PDF.

embed src="files/Brochure.pdf#toolbar=0&navpanes=0&scrollbar=0" type="application/pdf" width="100%" height="600px" />

Do you want to get implementation help, or enhance the functionality of this script? Click here to Submit Service Request