I'm developping a little application, trying to generate jpeg files from OpenOffice.org charts (I will maybe use it some day to generate stats reports displayed on a webpage...). To do this, nothing more simple to connect to a OOo instance, open the calc document, select the chart and use a GraphicExportFilter to save the shape to a jpeg image. It works well. But the remaining problem is to set the size of the exported image. All dimensions in OOO are expressed in mm. The JPEG export filter seems to convert those dimensions to the pixel unit using a "black box" formula. I noticed that using a factor around 37.88 tends to give me a way to convert from the pixel to mm units. But it seems it's not exactly this factor and in some case there is a limit size (2048x2048 ?). So my question is: what's this formula ? Is there some paper explaining this or some source file I can check out to know more about this ?
There exist a possibility to set the resolution, I am sorry it doesn't made it into the developers guide. The feature is available up from OOo 1.1. Each graphic filter is supporting a property sequence which is called "FilterData" therein you can set the size in pixel with the properties "PixelWidth" and "PixelHeight", the logical size (in 1/100mm) can be set with "LogicalWidth" and "LogicalHeight". The following basic macro is demonstrating this:
And here an example of how to use this macro: