How to display a PDF file directly in a Web page

Source: Internet
Author: User
Tags pdfobject


Blog Categories:Web Development 1, <embed width= "height=" src= "test_pdf.pdf" > </embed>

Browsers passed: 360, Firefox, IE, Chrome

2, <object classid= "clsid:ca8a9780-280d-11cf-a24d-444553540000" width= "" height= "" "Border=" "0" >

<param name= "SRC" value= "Test_pdf.pdf" >

</object>

Here's the complete point:

<object classid= "clsid:ca8a9780-280d-11cf-a24d-444553540000" width= "100%" height= "100%" border= "0" ><!-- Ie-->
<param name= "_version" value= "65539" >
<param name= "_extentx" value= "20108" >
<param name= "_extenty" value= "10866" >
<param name= "_stockprops" value= "0" >
<param name= "SRC" value= "Testing_pdf.pdf" >
<embed src= "testing_pdf.pdf" width= "100%" height= "href=" ></embed><!--testing_pdf.pdf
</object>

Browsers passed: 360, IE

Failed browsers: Firefox, Chrome

3, <iframe src= "test_pdf.pdf" width= "height=" ></iframe>

Browsers passed: 360, Firefox, IE, Chrome

4, with the browser directly to access http://127.0.0.1/test_pdf.pdf (in fact, this is not in the Web)

Browsers passed: 360, Firefox, IE, Chrome

All of the above four methods are under WinXP. (before have encountered the function of upload in Win7 under the condition of failure, so here explain the OS)

--------------------------------------------------------

Today there is a need to display the PDF in the Web page, so immediately began to search the solution, inadvertently found a very good solution, see http://blogs.adobe.com/pdfdevjunkie/web_designers_guide.

In fact, just look at this site is enough, http://www.pdfobject.com/.


Record the main code:

Pdfobject.js Download: Http://pan.baidu.com/s/1kTJTiqr HTTP://PAN.BAIDU.COM/S/1KTJTIQR

<script type= "Text/javascript" src= "Scripts/pdfobject/pdfobject.js" ></SCRIPT>
<script type= " Text/javascript "> 
Window.onload = function () {
    var success = new Pdfobject ({URL:" pdf /cgvet22-08-2011v2p.pdf ", Pdfopenparams: {scrollbars: ' 0 ', toolbar: ' 0 ', StatusBar: ' 0 '}}). Embed (" pdf1 ");
};
</script> 
 
<div id= "pdf1" style= "width:700px; height:600px;" >it appears you don ' t have Adobe Reader or PDF support in this web browser. <a href= "~/pdf/cgvet22-08-2011v2p.pdf" >click here to download the Pdf</a></div>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.