Alternate method of inserting a .PDF file into HTML page

家住魔仙堡 提交于 2019-12-11 00:14:39

问题


Currently I'm using an embed tag with the src directed to the location of the .pdf however the embed tag does not allow for z-index manipulation or other div tags to be placed over it. After extensive searching for a fix to allow for embed tag z-index manipulation I have found that it is adobe that will not allow this to happen with their pdf files.

I need a way to insert (without using embed or iframe tags) a pdf document into an html page and allow other divs to overlap it.

Please Help!


回答1:


The <object> tag, maybe? If that won't do it, Adobe's probably going to win this one.




回答2:


You could drop the Acrobat plugin and use a server side tool to render the PDF to an image. Display that image on your page and overlay it with whatever divs you like.

There are many tools available (free and commercial) that can render PDF to an image. I've used PDFRasterizer.NET for this on a couple of ASP.NET projects.

A component like PDFRasterizer.NET will let you render PDF into images on the fly, streaming it back to the browser directly. On a typical page with text and some images or vector graphics rendering typically takes (much) less than a second. You can save the generated images to disk and use that as a cache to optimize performance. Unless you expect massive traffic there's no real need to process all documents offline.



来源:https://stackoverflow.com/questions/2337624/alternate-method-of-inserting-a-pdf-file-into-html-page

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