[ckan-dev] Previewing resources with Google Docs
Aaron McGlinchy
McGlinchyA at landcareresearch.co.nz
Thu Mar 19 20:45:40 UTC 2015
Hi, I tried the links below, the pdfs worked great, but the xls gave an error and did not load at all.
That was using both Firefox and IE
Cheers
Aaron
----------------------------------------------------------------------
Message: 1
Date: Wed, 18 Mar 2015 19:09:04 +0000
From: Ross Jones <ross at servercode.co.uk>
To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
Subject: [ckan-dev] Previewing resources with Google Docs
Message-ID: <FF432145-4B23-420E-87D0-B5C545F5A475 at servercode.co.uk>
Content-Type: text/plain; charset="us-ascii"
Hi,
After finally getting fed up with watching the Javascript loading spinner when trying to view Excel files (and only seeing the first sheet when it did load) I decided to try using the Google Docs preview which you can embed into your pages ( docs.google.com/preview?url= <http://docs.google.com/preview?url=><URL>&embedded=true for reference).
So I wrote https://github.com/rossjones/ckanext-gdoc <https://github.com/rossjones/ckanext-gdoc> which is an IResourceView that does just that - it will allow you use use the google docs previewer for .doc, .xls, .xlsx and .pdf file.. Wrote is a strong word, there really isn't that much to it.
I've deployed in on a test site I have been playing with today, and you can (hopefully) see the pdf previewing just fine at http://liverpool.servercode.co.uk/dataset/lcc-payments-of-invoices-to-vendors-over-500-april-2012/resource/3bdb30bd-afb1-4f68-a680-4bcb1bbf7174 <http://liverpool.servercode.co.uk/dataset/lcc-payments-of-invoices-to-vendors-over-500-april-2012/resource/3bdb30bd-afb1-4f68-a680-4bcb1bbf7174>
Unfortunately, *and totally defeating the point of the whole exercise*, Google Docs Previewer seems to be having a tough day with XLS files today - http://liverpool.servercode.co.uk/dataset/lcc-payments-of-invoices-to-vendors-over-500-april-2012/resource/a03edab7-ccbb-4af8-89e6-032716e56d0c <http://liverpool.servercode.co.uk/dataset/lcc-payments-of-invoices-to-vendors-over-500-april-2012/resource/a03edab7-ccbb-4af8-89e6-032716e56d0c>
If anyone could find ten minutes to give it a try and see if it works for them, I'd be eternally grateful. Well, for a while anyway, maybe not eternally. If this does eventually work (it has before so I assume Google is just having a bad day) then I'll add some config options to allow you to specify which formats it will cope with (i.e. it also supports PPT but I refuse to believe it is possible to call anything in a PPT data).
Cheers
Ross
p.s. I was impressed on doing my first IResourceView just how easy it was to do - much easier than I imagined it would be. Give it a try ....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20150318/9caec859/attachment-0001.html>
------------------------------
________________________________
Please consider the environment before printing this email
Warning: This electronic message together with any attachments is confidential. If you receive it in error: (i) you must not read, use, disclose, copy or retain it; (ii) please contact the sender immediately by reply email and then delete the emails.
The views expressed in this email may not be those of Landcare Research New Zealand Limited. http://www.landcareresearch.co.nz
More information about the ckan-dev
mailing list