How to display a PDF document in a Web page

Source: Internet
Author: User
Tags pdfobject

To display a PDF document in a Web page, you can do this:

================html==========================

================pdfobject.js==========================

/* pdfobject, Copyright (C) 2008 Philip Hutchison (pipwerks.com). Documentation and examples are at www.pdfobject.com. Version 1.2, April 2011. MIT Style License */var pdfobject=function (y) {if (!y| |! Y.url) {return false;} var w= "1.2", b=y.id| | false,i=y.width| | " 100% ", z=y.height| |" 100% ", R=y.pdfopenparams,a,x;var v=function () {var c=null;if (window). ActiveXObject) {c=new ActiveXObject ("acropdf.pdf"); if (!c) {c=new ActiveXObject ("PDF. Pdfctrl ");} if (c!==null) {return true;}} return false; var u=function () {var c,f=navigator.plugins,d=f.length,e=/adobe reader| Adobe pdf| Acrobat/gi;for (c=0;c<d;c++) {if (E.test (F[c].name)) {return true;}} return false; var t=function () {var c=navigator.mimetypes["application/pdf"];return (C&&c.enabledplugin); var s=function () {var c=null;if (U) | | V ()) {c= "Adobe";} Else{if (t ()) {c= "generic";}} return c;}; var q=function () {var e=document.getelementsbytagname ("html"); if (!e) {return false;} var c=e[0].style,d=document.body.style;c.height= "100%"; c.overflow= "hidden";d. margin= "0";d. padding= "0";d. height= "100%";d. overflow= "hidden"; var p=function (d) {var c= "", E;if (!d) {return C;} For (E in D) {if (D.hasownproperty (e)) {c+=e+ "="; if (e=== "search") {C+=encodeuri (d[e));} Else{c+=d[e];} c+= "&";} Return C.slice (0,c.length-1);}; var o=function (d) {var c=null;switch (d) {case "url": C=a;break;case "id": C=b;break;case "width": c=i;break;case "Height" : C=z;break;case "pdfopenparams": C=r;break;case "Plugintypefound": C=x;break;case "pdfobjectversion": c=w;break; return c;}; var n=function (d) {if (!x) {return false;} var c=null;if (d) {c= (d.nodetype&&d.nodetype===1)? D:document.getelementbyid (d); if (!c) {return false;}} Else{c=document.body;q (); i= "100%"; z= "100%";} C.innerhtml= ' <object data= ' +a+ ' type= ' application/pdf ' width= ' +i+ ' ' height= ', ' +z+ ' ' ></object> '; Return C.getelementsbytagname ("Object") [0];}; A=encodeuri (Y.url) + "#" +p (R); X=s (); This.get=function (c) {return O (c);}; This.embed=function (c) {return n (c);}; return this;};
=======================end========================

More examples can look at Pdfobject's homepage

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.