开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜