[ckan-dev] Previewing resources with Google Docs

Ross Jones ross at servercode.co.uk
Wed Mar 18 19:09:04 UTC 2015


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-0002.html>


More information about the ckan-dev mailing list