LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-29-2013, 09:30 PM   #1
baronobeefdip
Senior Member
 
Registered: Jul 2009
Distribution: Debian Squeeze
Posts: 1,267

Rep: Reputation: 32
How can I embed PDF documents in an HTML file


I have seen this done many years (I get a web page with adobe acrobat open inside of a small box where the pdf is displayed). I want to be able to do this in HTML code. I want to have an embedded pdf file inside of a box displayed in an html page. I have tried the many reccomendations that have been suggested throughout the internet but many require third party services to hold the file somewhere for hosting. I want to host my own pdf file so I can embed it myself. I'm guessing that if you leave the pdf file alone and never access it for a while they remove it, that's only my guess I just want to be able to embed a pdf document in an html page without installing anything extra.
 
Old 03-30-2013, 08:09 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Google may be your friend here: search for "embed pdf in html" turns up quite a few ways to do so, including http://pdfobject.com/markup/, http://www.ezround.com/html/pdfiframe.html among others.

More than one way to skin a cat.

Hope this helps some.

Last edited by tronayne; 03-30-2013 at 08:12 AM.
 
Old 03-30-2013, 11:43 AM   #3
baronobeefdip
Senior Member
 
Registered: Jul 2009
Distribution: Debian Squeeze
Posts: 1,267

Original Poster
Rep: Reputation: 32
It just worked, I embedded the code like this
Code:
<html>
	<head>
		<title>Hello Worlds, I just learned how to embed a pdf</title>
	</head>
	<body>
		<iframe id="fred" style="border:1px solid #666CCC" title="PDF in an i-Frame" src="http://216.82.199.195/images/pdf/walton.pdf" frameborder="1" scrolling="auto" height="1100" width="850" ></iframe>
	</body>
	
</html>
And it did the trick, i never looked into using iframe (mainly because I haven't coded HTML in a while, I just use CMS platforms now but I see some need to insert html every now and then). The way it works is that it depends on what kind of browser you have and what types of plugins it has, Some have the plugins to display embedded PDFs and some don't. I tried it with two different browsers. The browser I tried first was epiphany which downloaded the pdf file into the downloads directory and only displayed a rectangle. Next I tried chrome (a more feature-full browser should do the trick). And low and behold the browser has the appropriate pdf reading plugin (chrome's native pdf reader) and it turned up. Never thought about iframe before you brought it up. I am wondering now if it's possible to embed word documents, and presentations (a stretch i guess but I'm just wondering)
 
Old 03-30-2013, 12:47 PM   #4
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Think I'd stick with PDF -- unless, of course, you're only serving Microsoft platforms with Word (or the significantly more expensive Office) available on the boxes. You might get lucky and have a visitor that has LibreOffice or OpenOffice (both of which can deal with all the Office formats), but, then, maybe not, eh? There are browser plug-ins for Word and the like, but those do point to software living on the box, ya know.

The entire rationale for PDF is that it's Portable Document Format; Firefox has an embedded reader, KDE has Okular, Linux has more than a couple of PDF readers. 32-bit boxes (or multilib-enabled ones) have Adobe Reader (no 64-bit Reader... yet, perhaps never).

Anyway, glad to know you got 'er going.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Embed jpg to html ust Linux - Newbie 7 07-16-2012 03:51 PM
embed terminal in html-php webpage maradnus Programming 2 12-07-2011 11:28 AM
How can I make PDF documents smaller (In file size)? vdemuth Linux - Software 7 11-05-2011 09:39 AM
LXer: Linux PDF editor for manipulating PDF documents LXer Syndicated Linux News 0 12-19-2007 09:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration