How to display PDF on PHP website without Flash/Adobe

I am not satisfied with the browsers internal behaviour of displaying PDFs. I would like to provide my users with an easy yet stylish PDF viewing experience on my sites. Something like Scribd, but managable and unter full security and control on my server.

I could provide inline links to GoogleDocsViewer or ZohoViewer. Or convert the PDF right after its upload with SWFTools and show the swf with native PHP or HTML5.

Anyway, somehow, after hours of reading and thinking, I am just not happy with any of the above approaches.

Any suggestions?


Take a look at Google Docs Viewer. The following code will help you (untested):

<iframe src="http://docs.google.com/gview?embedded=true&url=PDF-URL" style="width:600px; height:500px;" frameborder="0"></iframe>

Update 13.09.2016: Google removed their generator. Even though, you can still use the viewer by appending the escaped document-url to the url above manually.


I had to do something similar and finally I opted for generating images with ImageMagick, its works exactly the same way like Google Viewer.

But, if you want, you still can try to use PDF.js its from Mozilla and want to replace de browser PDF plugin.

链接地址: http://www.djcxy.com/p/54760.html

上一篇: 如何在Ubuntu上安装lxml

下一篇: 如何在没有Flash / Adob​​e的情况下在PHP网站上显示PDF