Welcome to WebmasterWorld Guest from 54.166.189.88

Forum Moderators: incrediBILL

Message Too Old, No Replies

how to open .pdf file in webpage

     
3:50 pm on Jun 14, 2012 (gmt 0)

New User

5+ Year Member

joined:June 12, 2012
posts: 7
votes: 0


hai,i am trying to open .pgf file in webpage .
i am able download it from like .but i want to view the .pdf fie in page
thank's
4:41 pm on June 14, 2012 (gmt 0)

New User

5+ Year Member

joined:June 14, 2012
posts:4
votes: 0


Adobe Reader will help you to do that!
4:44 pm on June 14, 2012 (gmt 0)

New User

5+ Year Member

joined:June 12, 2012
posts:7
votes: 0


this is my code
<a href="content.pdf">content</a>
if i click the link .
it is downloading the content.pdf file but
i want to view that content.pdf file in my webpage
i am new for this
please help me..
thank's
8:30 pm on June 14, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:13744
votes: 462


The problem is not in the page code. Displaying pdf files is based on the user's browser. There are two parts: the browser's own capabilities-- possibly including optional plug-ins-- and the user's preference settings.

So if you are trying to ensure a certain behavior, it simply can't happen.
8:42 pm on June 14, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10859
votes: 67


this isn't a browser/html issue - you need to fix this in the server response.
which HTTP Response headers are provided with the pdf file?
i would suggest that you need the following to meet your requirements:
Content-type:application/pdf
Content-length:[12345]
Content-disposition:attachment; filename=[foo.pdf]

[square brackets replaced with actual values]
5:25 pm on June 15, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


(phranque: content-disposition: attachment is meant to force a download - isn't it? Isn't that the problem salman is having already?)

Welcome aboard salman, if you are unable to VIEW them or they download automatically - it means either you don't have the plugin installed OR the server is not configured to serve .pdf's as PDF's (see first part of previous post.)

A corollary, if you have uploaded these pdf's in ASCII mode, they won't be viewable in any case. Make sure you upload PDF's in binary mode.

If you can VIEW the pdf file but want it "in the page" instead of "being the whole page" you will have to use an iframe or frames.

<iframe src="myfile.pdf" width="600" height="600">

or

(in frame-nav.html" below)
<a href="myfile.pdf" target="pdf-frame">

<frameset cols="25%,*">
<frame src="frame-nav.html" name="frame-nav" id="frame-nav"/>
<frame src="pdfs-will-load-here.html" name="pdf-frame" id="pdf-frame"/>
</frameset>
9:02 pm on June 15, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10859
votes: 67


welcome to WebmasterWorld, salman!
(sorry i missed that before)

content-disposition: attachment is meant to force a download - isn't it?

yes, rocknbil, my mistake - i copied some standard code and didn't finish editing before submitting.

salman - you specifically DON'T want the "content-disposition: attachment" header and you MUST have the "Content-type:application/pdf" header.
11:44 am on June 20, 2012 (gmt 0)

New User

5+ Year Member

joined:June 12, 2012
posts: 7
votes: 0


Thank you all..it is very helpful.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members