Home
hiteshBhatia edited this page Sep 26, 2010
·
8 revisions
This plugin integrates power of Google doc pdf viewer to your application , though this plugin has been created using Grails-1.3.4 but it supports all version from Grails-1.1.
Example - Whenever pdf is attached as attachment to gmail , it gives two options
- download
- View When user selects view is opens pdf in GoogleDoc , similar effect is provided by this plugin , all user needs to do is give full path to tag provided by taglib.
- With this plugin end user will be able to read/print pdf, even if pdf reader is not installed on his machine/browser.
- For application security pdf link is expired after first hit from Google.( If opened in Chrome mode link does not expire)
##Installation
- grails install-plugin pdf-viewer
- sample application can be found at http://github.com/IntelliGrape/Grails-Google-PDF-Viewer-Demo
- Read only code of sample application along with inline plugin can be cloned by git://github.com/IntelliGrape/Grails-Google-PDF-Viewer-Demo.git
- To use this plugin , user needs to use isSupportedByGoogleDocs tag of PdfTaglib , which checks whether doc is supported by Google Doc and if its supported a link is created to Google Docs.
<pdf:isSupportedByGoogleDocs params="['fullPath':fullPath,chrome:true]">
View on Google Docs
</pdf:isSupportedByGoogleDocs>
- Here fullPath is full path of file along its name . ex /home/username/pdfname.pdf
- param chrome is optional here. if opened in chrome mode , i.e chrome:true , then Pdf is opened with Menu.
- Make sure that action viewPdf of controller pdfViewer pubic.
- Since google needs to hit your application , will not work on local machines.
##Test For local machine
- Click on the link generated by taglib.
- Remove "http://docs.google.com/viewer?embedded=true&url=" from Url in address bar , hit remaining url (this test does not work for chrome mode).
- If download prompt appears , Its working fine
IMPORTANT: Action viewPdf of controller PdfViewer must be public, so that google can access it.
####For any queries and suggestions mail us at