Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to embed pdf in html

 
Amit Sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Is there any way to embed pdf file in html. so that i can view it in browser.
I have used following tags but these are not supported in many browsers.


<object data="test.pdf" type="application/pdf" width="300" height="200"> </object>

<embed src="test.pdf" type="application/pdf"></embed>
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTML has no provisions for embedding PDFs. You can provide a link to the PDF; and then it either gets downloaded, or it may get displayed in the browser if there's a plugin for PDFs. That's dependent on the browser configuration, though, and there's nothing the web app can do about it.
 
salvin francis
Bartender
Posts: 1268
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amit Sharma wrote:... but these are not supported in many browsers...

I doubt this is a browser feature,

I think you will have different results with a machine having IE7 installed with no pdf readers vs a machine having IE7 with adobe acrobat installed
if that's the case, this is not a browser issue...
 
Amit Sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i have adobe acrobat installed on my machine and firefox and IE7 . still i am not able to see the pdf in browser.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you now trying to do this? As was mentioned before, OBJECT and EMBED do not support PDFs.
 
Amit Sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i am using this one

test.pdf

 
Amit Sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not able to display exact code. That was href tag
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what happens if you click the link? As I said before, the browser may be set to download and save PDFs silently; check its default download directory.
 
Amit Sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Ulf when i am clicking that link that pdf get opened in a new window(not in the browse window).
But that is not the exact solution i am looking for, actually i want to display it in browser only. Is it possible.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Mr. Ulf hinted, HTML doesn't support embedding PDF in pages.
 
salvin francis
Bartender
Posts: 1268
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amit,

what if you have a link whose href is a pdf file,
what happens when you click that link ?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic