Jarnal - Howto Use Word Documents as Backgrounds

by David K. Levine
A new and not well tested feature of Jarnal is the ability to use openoffice to expand the range of documents that can be used as backgrounds to formats supported by openoffice. This includes openoffice documents and other odf documents, as well as documents produced by Microsoft Word, such as .doc's.

Once installed, if you open a file as a background (from the dialog or command line) and Jarnal can't figure out how to read it, then it will try to get openoffice to convert it to a pdf. If the conversion is successful, and the file named (for example) myfile.doc, a new file called myfile.doc.pdf will be created in the same directory, and Jarnal will open that file as the background.

To use this feature you must have openoffice installed; this is true by default on most Linux systems, but regardless, it is a free download here. The rest of the installation must be done by hand.

1. Modify your jarnalshell.conf file in your home directory by adding the line pdfconverter=soffice. Instead of soffice you should use the path to the openoffice executable on your system: soffice will work on many but not all systems. Do not include any command line switches.

NEW NEW NEW: try downloading the installer document - open it and click on the box. If this works, you can skip the rest.
[Warning 1: the April 30 version of the installer and the script below had a bug]
[Warning 2: There is a bug in openoffice 2.0 that prevents the macro from working: upgrade to openoffice 2.1]

2. Run openoffice and go to tools | macros | organize macros | openoffice.org basic. Click on organizer, then on new. Create a new module called Convert (this should be under My Macros | Standard). Click on the module, then on edit, and past the following code (based on code found here)

Sub ConvertToPDF(iFile, oFile)
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
iURL = ConvertToURL(iFile)
oPropertyValue.Name="Hidden"
oPropertyValue.Value=True
oDoc = StarDesktop.loadComponentFromURL(iURL, "_blank", 0, Array(oPropertyValue,))
oURL = ConvertToURL(oFile)
oPropertyValue.Name = "FilterName"
oPropertyValue.Value = "writer_pdf_Export"
oDoc.storeToURL(oURL, Array(oPropertyValue,))
oDoc.close(True)
end sub