2004-04-05
Foreword
This article will describe the conversion of Compendium-TA graphs into SVG format and the use of the free Open Office tools to do so.
Tips: Compendium-TA graphs should all have the fonts set correctly before exporting, and the OpenOffice scaling should be from the context menu instead of resizing with drag
Table of Contents
I have been experimenting with docbook, the xml markup language and wanted to be able to embed graphs in it in Scalable Vector Graphic format (svg) which is an xml vector markup language, for output in pdf as I thought that the resolution and scalability of svg might be better than a jpg .
At the moment, Compendium-TA does not export graphs as svg, but it does support Windows Meta File (wmf) and Enhanced Meta File (emf) formats which are both vector formats. I thought that it would be a simple matter to convert wmf to svg using 3rd Party software.
I tried the following products, in this order, before I discovered that OpenOffice was the tool to use:
The Gimp is an incredible piece of free software that everyone should evaluate when looking for a new graphics package. And although The Gimp supports both wmf and svg, I could not get The Gimp to load the wmf files produced by Compendium-TA, although they load well into every other wmf supporting tool that I have used. ( I confess that the previous versions of The Gimp were too buggy for me to rely on and I bought PaintShop Pro instead, sadly PaintShop Pro does not export svg files.
ImageMagick is a free library for image manipulation. And while it claims to be able to handle wmf and convert it to svg. I had no luck in being able to convice it to convert wmf into anything other than a black square.
SVGFactory is a free utility to convert wmf files to svg. Unfortunately it doesn't handle text so I couldn't convert the node and link labels, but I have kept it on my list of possibly future tools because it is free and it converted the basic graphics quite well. I couldn't use it to convert the graphs though.
I was dubious when I installed Open Office as pre 1.0 versions hadn't been impressive or stable, but I was much more impressed with the current version (1.1.1) and was able to use the drawing tool supplied with Open Office to convert my wmf files into svg files. For the rest of this document I will detail the steps that I used to do that.
This section will document the steps required to ensure the best svg conversion.
Starting with the graph in Compendium-TA, ensure that all the nodes and links have a vector font set.
The default font in Compendium-TA is MS Sans Serif, which is good and clear for bitmap output, but doesn't seem to work too well when converting to wmf. So I changed the fonts on all the nodes and links.

Select all the objects that you want to change, Ctrl-a selects them all.
Choose a font from the font drop down.
Make sure that the font option is ticked on the left so that it will be applied to the selection
Ensure that the 'Apply Style To Node' and 'Apply Style To Link' are set appropriately
Then press the button to make the changes to the selection.
Now export the graph to .wmf format by right clicking on the graph and choosing ->
Start the drawing tool for OpenOffice:

Open the saved .wmf file ->
And you should see the wmf file opened, but it will be very small

If it doesn't look as clean as this, or some of the fonts are too large then go back to Compendium-TA and change them to a font that OpenOffice can display correctly.
Select the wmf picture with a single left mouse button click.
Right click and choose from the pop up menu
Make sure that is checked, then change the size values
The above procedure allows you to scale the svg file accurately, as simply dragging the selection box does not maintain the ratio.
To save the file choose -> and set the file type to be svg