Show pdf file into browser without Adobe Reader

怎甘沉沦 提交于 2019-12-23 12:52:52

问题


I need to open pdf file into browser without Adobe Reader. Is there any API with php which open PDF files into browser.

Regards


回答1:


You can use SWFTools to convert PDFs to Flash. But SWFTools default skins are not looking good at all, so you can check Flexpaper as a viewer. In case you are going to make your own skin, then could be useful to read: SWFTools (pdf2swf) to properly work with Flex

Another solution is pdf.js (as Quentin point out), but AFAIR this script was not usable(back then, when I looked for) for PDFs with complex structures (complex gradients for example).

If you need to publish documents as "private" you should look at services as Issuu or you will have to protect files from downloading.




回答2:


No.

PHP runs on the server. The only "browser API" it has access to is HTTP.

If you want to render a PDF on the client, then the client needs a PDF renderer. There are JavaScript PDF readers, but I can't comment on their cross-browser support or maturity.




回答3:


If you pdf files are put online and not restricted, you can try using Google Doc Viewer. It's a very nice way to put the Viewer in <iframe /> so that it can be combined with your web page.

https://docs.google.com/viewer




回答4:


It is not feasible to view the PDF files without a viewer like Adobe Reader. If you just don't want to use Adobe Reader, you may try a PDF viewer plug in for web browser from some other company.

However, if you do not want to use a viewer at all and want to write/build your own viewer then a better option is to convert the PDF to scalable images and then show them on the web page using image tags. You can also create such a viewer using JavaScript.

Even you can find many already available JavaScript based viewers which can show those images.



来源:https://stackoverflow.com/questions/9308482/show-pdf-file-into-browser-without-adobe-reader

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!