找到你要的答案

Q:How to display PDF File without plugin?

Q:如何无插件显示PDF文件?

I need something like Google offers with https://docs.google.com/gview?url=.

Here an example: https://docs.google.com/gview?url=https://www.adobe.com/enterprise/accessibility/pdfs/acro6_pg_ue.pdf

This is perfect. It works on mobile, works with .docs files etc. Just awesome.

But the problem with this solution:

  • File has to be public
  • You don't know what Google does with this file
  • (Limited queries)

I just need a modern way do display PDF (or maybe even .docs etc.) files. Or is <embed> and <object> the only really working option.

It should work on all browsers and mobile.

Edit: Not sure, why the downvote. If this is a noob question I am sorry but I am a noob.

我需要像谷歌提供https://docs.google.com/gview?url =。

Here an example: https://docs.google.com/gview?url=https://www.adobe.com/enterprise/accessibility/pdfs/acro6_pg_ue.pdf

这是完美的。它可以在移动,工作文档文件等,真是太棒了。

但这个问题的解决方案:

  • File has to be public
  • You don't know what Google does with this file
  • (Limited queries)

I just need a modern way do display PDF (or maybe even .docs etc.) files. Or is <embed> and <object> the only really working option.

它应该在所有的浏览器和移动。

编辑:不知道,为什么downvote。如果这是一个菜鸟的问题我很抱歉,但我是一个菜鸟。

answer1: 回答1:

Opening PDFs in browser can be accomplished with PDF.js

https://github.com/mozilla/pdf.js/

It's the standard way Firefox presents PDFs inline. For doc-files you have to do some kind of conversion: In order to view doc-files I would convert a requested file to a pdf in the backend like posted here:

http://superuser.com/questions/156189/how-to-convert-word-doc-to-pdf-in-linux

在浏览器中打开PDF文件可以完成pdf.js

https://github.com/mozilla/pdf.js/

这是标准的Firefox了PDF内联。因为你的DOC文件做某种转换:为了查看doc文件我会将请求的文件在后台像PDF贴在这里:

http://superuser.com/questions/156189/how-to-convert-word-doc-to-pdf-in-linux

javascript  html5  pdf