Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jawish/jquery.gdocviewer
jQuery plugin that automatically embeds the Google Docs Viewer for viewing pdf, doc, docx, ppt and tiff files linked to by anchor tags.
https://github.com/jawish/jquery.gdocviewer
Last synced: 21 days ago
JSON representation
jQuery plugin that automatically embeds the Google Docs Viewer for viewing pdf, doc, docx, ppt and tiff files linked to by anchor tags.
- Host: GitHub
- URL: https://github.com/jawish/jquery.gdocviewer
- Owner: jawish
- Created: 2014-04-20T05:30:12.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-07-19T09:38:33.000Z (over 5 years ago)
- Last Synced: 2024-10-05T11:18:14.132Z (about 1 month ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 31
- Watchers: 3
- Forks: 33
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-maldives - Jquery.gdocviewer - jQuery plugin that automatically embeds the Google Docs Viewer for viewing pdf, doc etc.. (Table of Contents / JAVASCRIPT Projects)
README
jQuery plugin that automatically embeds the Google Docs Viewer for viewing pdf, doc, docx, ppt and tiff files linked to by anchor tags.
The Google Docs Viewer is an embeddable browser-based viewer that requires only a URL to a file available online. This neatly bypasses the need for users to have compatible software on their machines for those file types and displays the document right in the browser.
## Usage
1. Add jQuery and the gDocsViewer plugin to the page.
```html```
2. Set some class name or id to the anchor tag for all URLs to files that you want to be displayed using the Google Docs Viewer. E.g. "embed"
```html
Download file
Download file
```3. Initialize gDocsViewer and set it to process the URL with id or all URLs with the class name set in the previous step.
```js
$('a.embed').gdocsViewer();
$('#embedURL').gdocsViewer();
```## Customization
The plugin offers two configuration options that set the width and height of the embedded document IFRAME. This can be set when the plugin is initialized.
1.
$('a.embed').gdocsViewer({ width: 400, height: 500 });The plugin inserts a the IFRAME for the viewer inside an injected DIV. The DIV tags all carry the class name "gdocsviewer", which allow for styling all the gdocsViewer instances via CSS. If the anchor tag has the ID attribute defined, then the injected DIV tag is also set an ID attribute in the format of ID_of_Anchor + '-gdocsviewer'. See the demo source code for more details.
## Demo
- Check out the live demonstration (http://www.jawish.org/blog/uploads/jquery.gdocsviewer_demo.html)## License
This script is released under the Open Source MIT License, allowing its use in both personal and commercial applications as long as the copyright and license permission notice remains intact.