{"id":1792,"date":"2010-10-14T02:03:56","date_gmt":"2010-10-13T20:33:56","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=1792"},"modified":"2016-12-19T15:06:31","modified_gmt":"2016-12-19T09:36:31","slug":"grails-pdf-viewer-plugin","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/grails-pdf-viewer-plugin\/","title":{"rendered":"Grails Pdf Viewer Plugin"},"content":{"rendered":"<p>In one of our recent Grails project we had to provide support for Viewing Pdf even if end user&#8217;s browser did not have any  pdf viewer plugin or add on installed. So we decided that we would open our pdf on Google Doc&#8217;s pdf viewer.<\/p>\n<p>This will behave in same manner as Gmail does , when it has a pdf as attachment to mail , It provides two buttons<br \/>\n1. View<br \/>\n2.Download<br \/>\nNow if user selects view , the pdf viewer opens in Google Doc. <\/p>\n<p>We implemented this in our project and I <a href=\"http:\/\/www.tothenew.com\/blog\/opening-pdf-in-google-docs-using-time-based-cache\/\">extracted code from it <\/a> to create a <a href=\"http:\/\/www.grails.org\/plugin\/pdf-viewer\">plugin (pdf viewer).<\/a><\/p>\n<p>Installation of plugin<\/p>\n<pre lang=\"groovy\">\r\ngrails install-plugin pdf-viewer\r\n<\/pre>\n<p>Usage <\/p>\n<pre lang=\"groovy\">\r\n<pdf:isSupportedByGoogleDocs params=\"['fullPath':fullPath]\">\r\n       View on Google Docs\r\n<\/pdf:isSupportedByGoogleDocs>\r\n<\/pre>\n<p>Here fullPath is full path of file along its name . ex \/home\/username\/pdfname.pdf . And Pdf is a taglib included in this plugin.<\/p>\n<p>Detailed documentation of plugin can be found at <a href=\"http:\/\/github.com\/IntelliGrape\/Grails-Google-PDF-Viewer-Plugin\/wiki\">  GitHub <\/a><\/p>\n<p>Demo App  for this plugin can be found at  <a href=\"http:\/\/github.com\/IntelliGrape\/Grails-Google-PDF-Viewer-Demo\">Github<\/a> <\/p>\n<p>_________________________________<br \/>\nHitesh Bhatia<br \/>\n<a href=\"mailto:hitesh@intelligrape.com?subject=Feedback On Blog\">Mail<\/a><br \/>\nLinkedIn,<a href=\"http:\/\/www.facebook.com\/home.php?#!\/profile.php?id=100000114437286\" target=\"_blank\">Facebook<\/a>,<a href=\"http:\/\/twitter.com\/d1_ricky\" target=\"_blank\">Twitter<\/a><br \/>\n_________________________________<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In one of our recent Grails project we had to provide support for Viewing Pdf even if end user&#8217;s browser did not have any pdf viewer plugin or add on installed. So we decided that we would open our pdf on Google Doc&#8217;s pdf viewer. This will behave in same manner as Gmail does , [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":2},"categories":[7],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/1792"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=1792"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/1792\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=1792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=1792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=1792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}