I can't use OpenOffice.org at work, so I try to use it for private stuff, as far as possible. Sometimes, though, I start wondering why ... In the my current version of OpenOffice Draw (2.0.4, updated to 2.2.1, still the same ), it is impossible to export an image in a different resolution than 96dpi. Unless one uses workarounds like eps+ghostscript, pdf, or a macro. I loaded an foto from my camera, 2272x1704 (4 MP), added some numbers and lines, and exported it into jpg, png etc. ... and got 1016x762. With different jpeg compression qualities, of course, but no different sizes. Joe pointed me to the OO QA tracker, issue 4499; a short summary:
- the problem is known since May 2002
- it was closed due to a misunderstanding of the problem in July 2002
- reopened shortly after (OO 1.0)
- since then, reasons for not fixing it have been given ... main problem: all filters need to be extended with the same functionality, thus, an extension to all the export dialogs needs to be requested, designed and implemented
- last post, "No promises but I try to do something for 2.3 here"
Sub ExportCurrentPageOrSelection
REM Filter dependent filter properties
Dim aFilterData (7) As New com.sun.star.beans.PropertyValue
Dim sFileUrl As String
' set the width and height you want
aFilterData(0).Name = "PixelWidth"
aFilterData(0).Value = 1704
aFilterData(1).Name = "PixelHeight"
aFilterData(1).Value = 2272
' no real idea what the logical width/height does ... and what units it is in?
' original was 140 and 98.89 ...
aFilterData(2).Name ="LogicalWidth"
aFilterData(2).Value = 1704
aFilterData(3).Name ="LogicalHeight"
aFilterData(3).Value = 2272
' jpeg quality
aFilterData(4).Name ="Quality"
aFilterData(4).Value = 85
aFilterData(5).Name = "ColorMode"
aFilterData(5).Value = 0
aFilterData(6).Name = "ExportMode"
aFilterData(6).Value = 1
' resolution, for use when loading in another image application
aFilterData(7).Name = "Resolution"
aFilterData(7).Value = 600
' the place to put it ... file:///C:/temp/image.jpg should work for Windooze
sFileUrl = "file:///home/meself/export-1.jpg"
REM A smart person would force this to be a Draw or Impress document
xDoc = ThisComponent
xView = xDoc.currentController
xSelection = xView.selection
If isEmpty( xSelection ) Then
xObj = xView.currentPage
Else
xObj = xSelection
End If
Export( xObj, sFileUrl, aFilterData() )
End Sub
Sub Export( xObject, sFileUrl As String, aFilterData )
Dim xExporter
xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" )
xExporter.SetSourceDocument( xObject )
Dim aArgs (2) As New com.sun.star.beans.PropertyValue
Dim aURL As New com.sun.star.util.URL
aURL.complete = sFileUrl
aArgs(0).Name = "MediaType"
aArgs(0).Value = "image/jpeg"
aArgs(1).Name = "URL"
aArgs(1).Value = aURL
aArgs(2).Name = "FilterData"
aArgs(2).Value = aFilterData
xExporter.filter( aArgs() )
End Sub
Note:
OpenOffice.org 2.3.0 is out now (Sept 17th, 2007), yet this problem is unchanged.