|
Cookbook /
PmDocConvertSummary: PmDocConvert makes it easy to upload and display formats that can be handled by OpenOffice.org on a PmWiki page.
Version: 0.09 alpha
Prerequisites: pmwiki 2.2
Status: Alpha
Maintainer: Ccox
Discussion: PmDocConvert-Talk
How can I easily embed/convert foreign documents inside of my wiki?How about? (:docconvert file=MyPresentation.ppt display=inline iborder=0:) (:docconvert file=MyDocument.doc display=inline iwidth=100%:) (:docconvert file=MySpreadsheet.xls display=inline headingrows=1,2:) DescriptionPmDocConvert makes it easy to upload and display formats that can be handled by OpenOffice.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. Installation
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.
UsageExecute 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. The general markup format is:
(:pmdocconvert file=upload-file
[convertto=convert-type]
[display=display-type]
[iborder=iframe-border]
[iscroll=iframe-scrollbars]
[iwidth=iframe-width]
[iheight=iframe-height]
[ialign=iframe-alignment]
[dcopts=options-to-DC.py]:)
Where:
convertto =
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 =
iborder,iscroll,iwidth,iheight,ialign
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
Examples(:docconvert files=MyPresentation.ppt convertto=pdf:) Since pdf is the default, you don't need convertto in this case. The result is a link (the default display) to the converted pdf file of the presentation. (:docconvert files=MyDocument.doc convertto=html iwidth=100%:) Since convertto=html, the assumption is that display=inline, so we set the IFRAME parameter to use the width of the browser space. (:docconvert files=MySpreadsheet.csv convertto=csv headingrows=1,2,8:) The default display for converrto=csv is an inline PmWiki table with rows 1,2 and 8 designated at PmWiki table row headings (bolded by default in PmWiki). (:docconvert files=QuietDocument.doc quiet=true:) Converts QuietDocument.doc to QuietDocument.pdf, but does not display anything.
(:docconvert files=SpecialDrawing.odp convertto=html iborder=0 dcopts='--BackColor=0xffffff
--LinkColor=0xffffff --ALinkColor=0xffffff --VLinkColor=0xffffff --UseButtonSet=-1:)
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. ContributorsCommentsSee discussion at PmDocConvert-Talk User notes : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |