Hello,
I have found an interesting issue.
Start libreoffice as following:
$ /usr/bin/libreoffice4.0 "--accept=socket,host=localhost,port=2002;urp;"
draw.odg contains some asian text. Let's export it using using
GraphicExportFilter. I created a sample python script for this
(drawpages.py):
$ cp draw.odg /tmp/
$ python drawpages.py
Now open /tmp/draw.png. Everything is displayed correctly.
Now start libreoffice in headless mode:
/usr/bin/libreoffice4.0 "--accept=socket,host=localhost,port=2002;urp;"
--headless
Repeat steps above. If you open /tmp/draw.png, you will notice that all
asian characters are mangled.
For convenience I attached drawpages.py and other documents. For clarity
here it is:
--------------------------
import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", localContext)
context = resolver.resolve("uno:socket,host=localhost,port=2002;"
"urp;StarOffice.ComponentContext")
desktop = context.ServiceManager.createInstanceWithContext(
"com.sun.star.frame.Desktop", context)
url = uno.systemPathToFileUrl('/tmp/draw.odg')
doc = desktop.loadComponentFromURL(url, "_blank", 0, ())
draw_pages = doc.getDrawPages()
page = draw_pages.getByIndex(0)
gf = context.ServiceManager.createInstanceWithContext(
"com.sun.star.drawing.GraphicExportFilter", context)
gf.setSourceDocument(page)
url = uno.systemPathToFileUrl('/tmp/draw.png')
pv1 = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
pv1.Name, pv1.Value = "URL", url
pv2 = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
pv2.Name, pv2.Value = "MediaType", "image/png"
args = (pv1, pv2)
gf.filter(args)
--------------------------
--
Regards,
Maxim
Attachment:
draw.odg
Description: application/vnd.oasis.opendocument.graphics
Attachment:
draw.png
Description: PNG image
Attachment:
draw1.png
Description: PNG image
import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", localContext)
context = resolver.resolve("uno:socket,host=localhost,port=2002;"
"urp;StarOffice.ComponentContext")
desktop = context.ServiceManager.createInstanceWithContext(
"com.sun.star.frame.Desktop", context)
url = uno.systemPathToFileUrl('/tmp/draw.odg')
doc = desktop.loadComponentFromURL(url, "_blank", 0, ())
draw_pages = doc.getDrawPages()
page = draw_pages.getByIndex(0)
gf = context.ServiceManager.createInstanceWithContext(
"com.sun.star.drawing.GraphicExportFilter", context)
gf.setSourceDocument(page)
url = uno.systemPathToFileUrl('/tmp/draw.png')
pv1 = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
pv1.Name, pv1.Value = "URL", url
pv2 = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
pv2.Name, pv2.Value = "MediaType", "image/png"
args = (pv1, pv2)
gf.filter(args)