pdf file display

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
artaka
Forum Newbie
Posts: 1
Joined: Mon Jan 26, 2009 3:05 pm

pdf file display

Post by artaka »

i am having problem displaying my pdf files directly on the browser.each time i click on the relative link to the pdf file, i am prompted to download it first before reading it.
but that is not what i want, i want it to display directly as it is on the browser.
i need your help. thanks
User avatar
nor0101
Forum Commoner
Posts: 53
Joined: Thu Jan 15, 2009 12:06 pm
Location: Wisconsin

Re: pdf file display

Post by nor0101 »

You can embed PDF content into valid XHTML by using the <object> tag.

Code: Select all

 
<object data="somefile.pdf" type="application/pdf" width="770" height="500">
    download the document: <a href="somefile.pdf">somefile.pdf</a>
</object>
 
If the user's browser has the appropriate plugins, the document will be embedded into the page. If not, the content inside the object tags will be rendered - in this case, a simple link to the document.

Google search for "embed PDF object" for more examples.
Post Reply