use batik-rasterizer without GTK [closed]
i'm using the Apache Batik SVG Rasterizer Library in python, but when i try to convert a svg into png i get this error Gtk-WARNING **: cannot open display:
How can i do to don't use GTK to convert the SVG file
Thanks and sorry for my english!
my code is this
gij --jar batik/batik-rasterizer.jar file.svg
I use GIJ couse is a shared hosting.
Thanks!!
Do you have a code sample. The error indicates that you are performing a plot on a headless/display less system. This may arise not due to an SVG conversion but due to a call to display a plot/window or something similar. The error will go away if you attach monitor or set the DISPLAY variable in the environment.
Also the error you are getting is only a warning. The batik rasterizer may depend on other dependency jar's which are not being supplied. May be you will need to use the classpath settings or a wrapper script. Try running batik-rasterizer from within the batik folder i.e.
cd batik; gij --jar batik-rasterizer.jar ../file.svg
Try this:
$ export DISPLAY=java; gij -Djava.awt.headless=true --jar batik/batik-rasterizer.jar file.svg
More on http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/
I found this info http://xmlgraphics.apache.org/fop/1.0/graphics.html#batik
Here are some workarounds:
- Start Java with the -Djava.awt.headless=true command line option.
- Install an X server which provides an in-memory framebuffer without actually using a screen device or any display hardware. One example is Xvfb.
- Install a toolkit which emulates AWT without the need for an underlying X server. One example is the PJA toolkit, which is free and comes with detailed installation instructions.
Here is "How to install Xvfb (X11 Server) in Linux Server" http://corpocrat.com/2008/08/19/how-to-install-xvfb-x11-server-in-linux-server/
精彩评论