![](/img/trans.png)
[英]How to view PDF on web, without using browsers builtin PDF viewer?
[英]How to add pdf viewer to website for mobile browsers
我希望用户能够通过在任何移动浏览器上访问时单击链接来查看pdf。 我已经尝试过,但是都给出“不支持此插件”的错误
<div id="pdf">
<iframe src="https://www.adobe.com/products/pdfjobready/pdfs/pdftraag.pdf" style="width: 100%; height: 100%;" frameborder="0" scrolling="no">
<p>It appears your web browser doesn't support iframes.</p>
</iframe>
</div>
<object data="lorem.pdf" type="application/pdf">
<p>It appears you don't have Adobe Reader or PDF support in this web browser. <a href="lorem.pdf">Click here to download the PDF</a>. Or <a href="http://get.adobe.com/reader/" target="_blank">click here to install Adobe Reader</a>.</p>
<embed src="lorem.pdf" type="application/pdf" />
</object>
您可以使用Google文档查看器
<iframe src="http://docs.google.com/viewer?url=" + PathToMyPdfFile + "&embedded=true" width="100%" height="100%" style="width: 100%; height: 100%;" frameborder="0" scrolling="no"></iframe>
如上所述,使用Google Docs Viewer 。
工作示例:
<iframe src="https://docs.google.com/viewer?url=https://www.antennahouse.com/XSLsample/pdf/sample-link_1.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
将示例链接https://www.antennahouse.com/XSLsample/pdf/sample-link_1.pdf
替换为所需的任何PDF。
要注意:
如果您在这里遇到此错误:
Mixed Content: The page at 'link' was loaded over HTTPS
确保链接中有https://
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.