Description

PmDocConvert makes it easy to upload and display formats that can be handled by OpenOffice.org/LibreOffice.org on a PmWiki page. This includes popular Microsoft formats like PowerPoint®, Excel® and Word®. Uploaded documents can be displayed inline or converted to other formats with links to that format.

PmDocConvert uses a program called DC.pyΔ to interface to OpenOffice.org running in daemon mode with PyUNO (Python/UNO) support. If you are using OpenOffice.org 3.0 or higher, chances are you have this support already built-in. Getting OpenOffice.org software to run in daemon mode is left up to the implementer, but I will share my soffice-daemon init script hereΔ. In particular this init script was designed for SUSE Enterprise Linux 10, but you can easily modify it for your own Linux distribution or Unix distribution. Note: The DC.py provided here is NOT the DocumentConverter.py script found at http://www.artofsolving.com/opensource/pyodconverter. I used that script to create DC.py.

Attempt to get the OpenOffice.org binary to start and stay daemonized (should run as same user as your web server... sorry).

Attempt to connect to it running DC.py (e.g. DC.py test.doc test.html) Note: you must run as the same user that owns the daemon.

That is part one. If you did not make it this far, then you will not make it any further. Feel free to look at the http://www.artofsolving.com/opensource/pyodconverter page for additional hints in trying to make this work. I did NOT try to test this under Windows.

If you have protected uploads, but in the necessary web server allowances for that pmdocconvert directory.

As of 1.0 PmDocConvert tries to allow for per page uploads.

Usage

Execute DC.py --help and it will show you the myriad of conversion options that can be used to it. The act of converting from one format to another is defined by the filters in OpenOffice.org and are done by looking at the extension types as far as DC.py is concerned.

convertto =

html

txt

png

jpg

gif

csv

pdf (default)

(etc...)

Converted files, apart from HTML conversion, are named using the basename of the upload-file followed by an extension appropriate to the conversion (e.g. file=upload.ppt converrto=jpg would result in a file called upload.jpg). Converting to HTML creates output in a directory in the uploads area named by upload-file.dir which contains the converted content.

display =

inline (attempt to show converted file inline. For html, display inside of an IFRAME.)

attach (display as an Attach:converted-file)

link (default) (display as a link to the attachment [[Attach:converted-file|converted-file]])

imagelink (display as [[Attach:upload-file|Attach:converted-file]]) For convertto= some image type.

iborder,iscroll,iwidth,iheight,ialign

iborder = size of IFRAME border

iscroll = true/false for scrollbars on IFRAME

iwidth = width of IFRAME

iheight = height of IFRAME

ialign = alignament left/right/center for IFRAME

dcopts =

You can include DC.py options through this. You can type DC.py --help for a full list.
For example, dcopts='--Format=2 --BackColor=0xff0000'

Other Options

quiet = true/false (if true, do not display anything, just convert)

headingrows = #,#,... (set to the row numbers to highlight when converting to csv inline display)

Yuk! What is that? Well, in Open Office, there's little difference between an Impress Presentation and a Drawing, so instead of using Open Office Draw, I used Impress... why? We can create object actions in Impress, for example, the ability to go to a different page by clicking on an object. Turns out that in HTML conversion an ImageMap is created to handle the hot spot areas. But using the Text (non-graphical) UseButtonSet, and by making all of the background, text and links white, it will look like an image, but it will have hot clickable areas defined.