GraphicExportFilter and headless mode

Maxim Lacrima lacrima.maxim at gmail.com
Tue Nov 26 06:14:51 PST 2013


I've just also created a bug report.

https://bugs.freedesktop.org/show_bug.cgi?id=72036

Thanks


On 26 November 2013 15:51, Maxim Lacrima <lacrima.maxim at gmail.com> wrote:

> 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
>



-- 
Regards,
Maxim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20131126/35a9c340/attachment.html>


More information about the LibreOffice mailing list