簡體   English   中英

如何在移動瀏覽器的網站上添加pdf查看器

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM