javascript 用于文档预览的 Jquery 脚本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9885824/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jquery script for document preview?
提问by RazerMK_02
Do you know any components from jQuery
with which you can preview .doc,.pdf,.jpg
.... files in browser ?
Thanks
您知道任何jQuery
可以.doc,.pdf,.jpg
在浏览器中预览.... 文件的组件吗?谢谢
回答by David Mulder
If you really want to keep it all native inside the browser you can display images on their own and pdfs with pdf.js.
如果您真的想将其全部保留在浏览器中,您可以使用pdf.js显示自己的图像和 pdf 。
If you only need to display it somehow I advise you to look at Google docs viewer(officially discontinued, see below) which allows you lots of different files and which you can next embed in one of the scripts altschuler mentioned. (See my comment to his answer why those tools alone don't do the trick)
如果您只需要以某种方式显示它,我建议您查看Google 文档查看器(正式停产,见下文),它允许您使用许多不同的文件,接下来您可以将它们嵌入到 altschuler 提到的脚本之一中。(请参阅我对他的回答的评论,为什么仅靠这些工具不能解决问题)
Supported file types by google docs viewer
谷歌文档查看器支持的文件类型
- Microsoft Word (.DOC and .DOCX)
- Microsoft Excel (.XLS and .XLSX)
- Microsoft PowerPoint (.PPT and .PPTX)
- Adobe Portable Document Format (.PDF)
- Apple Pages (.PAGES)
- Adobe Illustrator (.AI)
- Adobe Photoshop (.PSD)
- Tagged Image File Format (.TIFF)
- Autodesk AutoCad (.DXF)
- Scalable Vector Graphics (.SVG)
- PostScript (.EPS, .PS)
- TrueType (.TTF)
- XML Paper Specification (.XPS)
- Archive file types (.ZIP and .RAR)
- Microsoft Word(.DOC 和 .DOCX)
- Microsoft Excel(.XLS 和 .XLSX)
- Microsoft PowerPoint(.PPT 和 .PPTX)
- Adobe 便携式文档格式 (.PDF)
- 苹果页面 (.PAGES)
- Adobe Illustrator (.AI)
- Adobe Photoshop (.PSD)
- 标记图像文件格式 (.TIFF)
- Autodesk AutoCad (.DXF)
- 可缩放矢量图形 (.SVG)
- PostScript (.EPS, .PS)
- TrueType (.TTF)
- XML 纸张规范 (.XPS)
- 存档文件类型(.ZIP 和 .RAR)
Although I wouldn't recommend this usage on production or professional systems, you can still use the system as described here.
虽然我不建议在生产或专业系统上使用这种用法,但您仍然可以按照此处所述使用该系统。
回答by altschuler
I think you're looking for a lightbox feature. Lightbox is the common name for (pre)viewing things in an overlay, so to say.
我认为您正在寻找灯箱功能。可以这么说,Lightbox 是在叠加层中(预)查看事物的通用名称。
There are a great deal to choose from, here's a few:
有很多可供选择,这里有一些:
- http://gettopup.com(try the #2 example, this looks a lot like quicklook).
- http://leandrovieira.com/projects/jquery/lightbox
- http://Hymanlmoore.com/colorbox
- http://gettopup.com(试试#2 的例子,这看起来很像 quicklook)。
- http://leandrovieira.com/projects/jquery/lightbox
- http://Hymanlmoore.com/colorbox
How you want to show .doc and .pdf files is another issue.
您希望如何显示 .doc 和 .pdf 文件是另一个问题。