This is an old revision of the document!
Table of Contents
Google Docs Viewer Plugin
Compatible with DokuWiki
Adora Belle, Weatherwax
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
Installation
This plugin uses and depends on Google's Service. Please check and see first the Google Docs Viewer Terms of Service.
By using this service you acknowledge that you have read and agreed to the Google Docs Viewer Terms of Service. — Google Docs Viewer - Additional Terms of Service
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
Prerequisite to embed document stored in media directory
If your have set userewrite option to “1
” in order to get nicer URLs for your DW page, you do not need to do any more. The Google Docs Viewer Service will accept url of DW media document file ( for example: http://example.com/_media/ns:document.pdf ).
Otherwise, you need to prepare a virtual (sub)directory named “_media” in the same place where 'doku.php' file exists. You might setup it by one of following measures:
- make relevant entry in httpd.conf for apache
- make virtual directory using IIS admin panel
- make symbolic link – ln -s /path/to/data/media _media (linux)
- make Junction in NTFS for Windows 2003S – linkd -d _media /path/to/data/media
- Windows 2008S supports symbolic link
Examples/Usage
Show a given online document such as PDF documents or PowerPoint presentations in your DokuWiki page using Google Docs Viewer service. Please refer to Google site to know detail on supported file types.
Let's suppose you have a link (with small fileicon) to given online document in your page source:
{{:ns:document.pdf}}
To show the document in the embedded viewer, markup it with {{gview>
and }}
as follows:
{{gview>{{:ns:document.pdf}}}}
You do not need to remove {{
and }}
around document URL; When you decide to stop embedding in future, it is enough to delete only gview markup. However you may remove inner {{
and }}
to embed the document.
A most simple example:
{{gview>:ns:document.pdf}}
Some more complex example:
{{gview> :ns:document.pdf 50%,200px }} {{gview> {{:ns:document.pdf|title}} 400px }} {{gview> {{http://example.com/path/to/document.pdf|title}} noreference }}
Note
- The document to view must be “public to the world”.
- The DW page must be reachable from the internet (because Google's servers are used).
Limitation
- Unfortunatly, the Google Docs Viewer service seems not accept ugly url
( for example: http://example.com/lib/exe/fetch.php?media=document.pdf ). - Therefore, you may need to extra setup explained in Installation section.
Syntax
{{gview> id [size] [noembedded] [noreference] }}
- id : DW media “id” or full URL of the online document to view (must starts with “http:” or “https:” ).
- This means you may embed a document published at different web site. The source url (reference) acknowleged above the viewer frame.
- you can use “{:ns:file.ext|title}” format that is inserted via media manager.
- size : Size of embedded viewer.
- Default value is
100%,300px
, which means 100% width and 300px height. - When one value is given it is assumed to be the height.
- noembedded (or noembed)
- Indicate to show only hyperlink to the viewer, instead of embedded viewer.
- Document title specified after “|” in
{{
and}}
is used as a link text.
- noreference
- Suppress a reference line just above embedded viewer frame. The reference is a hyperlink (url) to the online document shown in the viewer.
Configuration and Settings
There are no configuration options for this plugin.
CSS
The class tpl_gview is avilable for selector of html element. Border settings for embedded viewer found in style.css.
Language file
en, ja, de
Development
This is first trial to develop my own plugin.
Change Log
I have just started github.
- due update plugin.info (2014-11-16 02:49)
- PHP5 strict (2014-11-16 02:48)
- fix to show title if noembed specified (2014-11-16 02:43)
- Merge pull request #1 from ssahara/dev (2014-06-14 05:34)
- plugin info updates (2014-06-14 05:30)
ToDo
consider URL rewrite to allow embedding media file in data/media directory in case of $conf['userewrite'] = 1; (rewrite ugly url: .../lib/exe/fetch.php?media=document.pdf → .../_media/document.pdf)- change syntax to
{{gview [size] [noembedded] [noreference] > id|title }}
in order to quickly get back to genuine DW syntax ({{id|title}
) by text replacement of .txt file using sed command via terminal shell.
FAQ
[discussions should ideally be deleted and turned into FAQ entries along the way]
Discussion
Show PDF documents stored in DW media
Thanks for this plugin!
It would be great, to view pdf documents stored in DW media directory. Joe, 2013-03-20
Thanks for your comment. It was my original objectives of this plugin. New release 2013-03-22 supports DW media docs with some prerequisite. I have tested CentOS6-Apache 2-Adora Belle and Win2003S-IIS6-Weatherwax RC1. — s.sahara 2013-03-22