DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:gview

Google Docs Viewer Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" yes
  • 2015-08-10 "Detritus" unknown
  • 2014-09-29 "Hrun" unknown

plugin Show online document using Google Docs Viewer Service or browser Plug-In

Last updated on
2014-11-16
Provides
Syntax
Repository
Source

Tagged with embed, google, html5

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 through the Extension Manager or Plugin Manager using the download URL above, which points to latest version of the plugin. Refer to plugin installation instructions.

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, change it as follows:

{{gview>:ns:document.pdf}}

Some more complex example:

{{gview 50%,200px > :ns:document.pdf}}
{{gview 400px> :ns:document.pdf|title}}
{{gview noreference> http://example.com/path/to/document.pdf|title }}

Note

  • The document to view must be “public to the world” when using Google's service.
  • 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 [size] [noembed] [noreference] > id|title }}
  • id : DW media “id” or full URL (must starts with “http:” or “https:” ) of the online document to view.
    • 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.
  • noembed (or noembedded)
    • 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.

trick syntax

There is another experimental trick syntax available. The markup key is “obj:” instead of “gview”.

{{obj:[class] [size] [noembed] [noreference] > id|title }}

which will embed media resource in html using HTML5 object tag. If you do not like to use google service, please try this usage. The {{gview ... > ... }} is simplified markup of {{obj:gview ... > ... }}.

Configuration and Settings

There are no configuration options for this plugin.

CSS

The class obj_container_gview is available 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.

ToDo

  • Support embedding Google document, sheet, presentation and drawings on Google Drive.
  • also, support Skydrive, even plugin name is not appropriate…
  • 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. → done at releaee 2013-05-26

FAQ

[discussions should ideally be deleted and turned into FAQ entries along the way]

Discussion

Great plugin! It would be good to be able to support the likes of the BOX viewer (HTML5). As it stands the correct height can be adjusted, but the width stays locked to 100%, even when changed to something else, i.e:

{{obj:  50%, 600px  noreference > https://view-api.box.com/1/sessions/7b8e51cb284a407ba5bec7a7fa2ba1b2/view?theme=light |Test}}

The viewer works correctly though, it is just the width adjustment.

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.saharas.sahara

2013-03-22

I actually have my DW site protected by .htaccess, which prevents gview from displaying the files.
If I rename .htaccess everything works fine.
Do you have some hints how to modify .htaccess for using with gview? This would be great. I tried a lot of hints from the web, but nothing worked. e.g.:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?docs.google.com [NC]
RewriteRule \.(pdf)$ - [NC,F,L]

Working under debian linux with ln -s /path/to/data/media _media Joe, 2013-09-02

plugin/gview.txt · Last modified: 2016-09-21 10:32 by atiq4pk