上传PDF文件预览 [英] uploaded PDF file preview

查看:434
本文介绍了上传PDF文件预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我需要查看PDF文件的预览,如图像预览。在我的项目中用户可以上传图片或PDF文件,上传后用户可以像上传图片框一样查看上传的文件。 PDF怎么可能,但图像的工作正常。请尽快帮助。

Hi,

i need view preview of PDF file like image preview. in my project user can upload image or PDF file, after upload user can view uploaded file as preview like image box. how is it possible for PDF but for image its working fine. pls help ASAP.

推荐答案

由于PDF不是W3标准的一部分,因此您不应该假设客户端完全支持PDF;它总是纯粹是可选的。即使是离线观看者也不一定可用。这就是为什么浏览器总会建议保存PDF文件的选项。



我不知道预览会给用户什么,所以我的第一个建议是:不提供任何预览。我确实理解这听起来令人沮丧,但我认为这是合理的解决方案之一;用户可以随时快速预览您在锚点中公开的任何文件。



另一种解决方案是使用一些映射将PDF处理成HTML,并呈现HTML预览。您需要了解PDF和HTML的概念是非常不同的,因此预览演示的方式是一个值得关注的问题。您将找到足够的开源产品进行转换: http://lmgtfy.com/? q = PDF +到+ HTML%22C%23%22 [ ^ ]。



最后,你可以做一些中间的事情。毕竟,为什么有人需要预览?因为它可能是同一文档的缩短版本。只有文档作者才能这样做。因此,您可以建议用户提供完整的PDF文档和缩短的HTML预览。这真的很有意义。



-SA
As PDF is not a part of W3 standards, you should not assume that a client has any PDF support at all; it's always purely optional. Even an off-line viewer does not have to be available. That's why the browsers will always suggest an option to save a PDF file.

I don't know what a preview would give the user, so my first suggestion would be: don't provide any preview. I do understand that it might sound frustrating, but I think this is one of the reasonable solution; the user can always quickly preview any file you expose in an anchor.

Another solution would be processing a PDF into HTML using some mapping, and presenting HTML preview. You need to understand that concepts of PDF and HTML are very different, so the way of preview presentation is a matter of some concern. You will find enough open-source products doing the conversion: http://lmgtfy.com/?q=PDF+to+HTML%22C%23%22[^].

Finally, you can make something intermediate. After all, why would anyone need a preview? Because it could be a shortened version of the same document. Only the document author can do it. So, you can suggest the user to supply both complete PDF document and shortened HTML preview. It really makes sense.

—SA


这篇关于上传PDF文件预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆