当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Which way works to put a PDF in an iframe?

问题描述:

I need a method that really works in IE, Chrome and Firefox to show a PDF in an iframe. I can not use google docs GView to do this... I need another method that is 100% functional. Give me some example please guys... I've tried PDFJS and PDFObject, but they do not work.

Thanks a lot.

网友答案:

PDF Object works to create a view of a pdf in an object. You can create an object, and reference it to an id:

HTML:

JavaScript:

var pdf = new PDFObject({
    url: "sample.pdf",
    id: "object",
    pdfOpenParams: {
          view: "FitH"
    }
}).embed("object")

Works cross browser! You just need to include PDF Object code in your project.

分享给朋友:
您可能感兴趣的文章:
随机阅读: