Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to embed a pdf file into an html5 page?

Tags:

html

ios

pdf

I want to have a web page coded with HTML5, and I want to be able to put a pdf file onto this page so you can view it without having to click on any links to download it separately. Anyone know how to do this? I want it to keep the text, images, and layout of the pdf file also. If that weren't the case I would just use an image. Thanks!

Edit: This will be hopefully going onto the ipad. So it won't support adobe. I need to just find a way to somehow make the pdf file show up in an html5 page without using a viewer. I want to keep all of its layers. It doesn't have to stay a pdf file when its on the page, I just need to find a way to transfer all of those layers there without having to do this manually with divs for each image, paragraph, etc.

like image 579
Catia Avatar asked Jun 24 '10 19:06

Catia


People also ask

How do I embed a PDF in HTML5?

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.

How do I add a PDF to a website in HTML?

Using an iframe tag is the second way to embed a pdf file in an HTML web page. In web development, web developers use the iframe tag to embed files in various formats and even other websites within a web page. Due to its wide compatibility, the iframe tag is widely used for embedding pdf.

How do I display a PDF in HTML page?

To embed the PDF in the HTML window, point the page to a document and then specify the height and width of the PDF so the HTML window is the correct size using the code: <embed src="filename. pdf" width="500" height="375">. Note that an embedded PDF may look very different on different browsers and operating systems.


2 Answers

I don't think this is possible without using Flash. Instead, you might want to convert the PDF to a different format (HTML for example) that can be rendered by the browser. There are tools that can do this from the command line, so making a script to do it on your site won't be too difficult.

like image 73
alecwh Avatar answered Sep 17 '22 12:09

alecwh


You can use the embed tag like this:

<embed src="/path/to/your/file.pdf" />
like image 26
chrisbjr Avatar answered Sep 18 '22 12:09

chrisbjr