javascript 无需下载即可在网页上查看 PDF 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10707397/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
View PDF files on a Web page without downloading?
提问by Xtreme
Have a bunch of pdf files I want to display on a web page (like google books). I do not want them to be possible to download, or at least hinder it.
有一堆我想在网页上显示的 pdf 文件(如谷歌图书)。我不希望他们可以下载,或者至少阻碍下载。
Are there any open soruce solutions? HTML5, Javascript?
有没有开源解决方案?HTML5,Javascript?
回答by mgraph
回答by timrwood
Here is a pdf viewer in javascript and html called pdf.js. However, in order for the pdf to get to the browser, it will still need to be downloaded.
这是一个名为 pdf.js 的 javascript 和 html pdf 查看器。但是,为了让 pdf 进入浏览器,它仍然需要下载。
There is no way to display something in a browser without downloading it. It may take a bit of work to find the original asset (looking through the network tab in chrome dev tools) but the original pdf will still be downloaded.
不下载就无法在浏览器中显示某些内容。找到原始资产可能需要一些工作(通过 Chrome 开发工具中的网络选项卡查看),但仍会下载原始 pdf。