问题
Do you know any components from jQuery
with which you can preview .doc,.pdf,.jpg
.... files in browser ?
Thanks
回答1:
If you really want to keep it all native inside the browser you can display images on their own and pdfs with pdf.js.
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)
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)
Although I wouldn't recommend this usage on production or professional systems, you can still use the system as described here.
回答2:
I think you're looking for a lightbox feature. Lightbox is the common name for (pre)viewing things in an overlay, so to say.
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://jacklmoore.com/colorbox
How you want to show .doc and .pdf files is another issue.
来源:https://stackoverflow.com/questions/9885824/jquery-script-for-document-preview