Problem in re-writing a command for Linux

General discussions about Inkscape.
jawed
Posts: 5
Joined: Fri Jul 13, 2012 1:14 am

Problem in re-writing a command for Linux

Postby jawed » Tue Oct 09, 2012 8:17 pm

Hello,

I am executing a command in my PHP script which converts all the texts of SVG to paths while using inkscape, here is the command I am using

inkscape --with-gui --verb EditSelectAll --verb ObjectToPath --verb FileSave --verb FileQuit logo.svg

Now after migrating to the Linux server that command throws a warning saying
(inkscape:20435): Gtk-WARNING **: cannot open display:

After searching on Google the problem seems to me that as the Linux server doesn't have the GUI it is unable to run that command. I tried replacing --with-gui to --without-gui although that didn't throw any error but didn't generate the output as well. Now my question whether it is possible to run the same command (--with-gui) in Linux ? If not then how that command can be re-written for the Linux?

Thanks
Jawed

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Problem in re-writing a command for Linux

Postby ~suv » Tue Oct 09, 2012 10:09 pm

jawed wrote:I am executing a command in my PHP script which converts all the texts of SVG to paths while using inkscape, here is the command I am using

inkscape --with-gui --verb EditSelectAll --verb ObjectToPath --verb FileSave --verb FileQuit logo.svg

Now after migrating to the Linux server that command throws a warning saying
(inkscape:20435): Gtk-WARNING **: cannot open display:
For using Inkscape in such a way you need to have some kind of X server installed and running on the server (a virtual frambuffer is sufficient), and have $DISPLAY set in the environment before calling inkscape. Possibly there is some kind of X server installed and running already, but doesn't propagate $DISPLAY correctly for the user who executes the command from the PHP script, or that user has not sufficient priviledges to use that specific $DISPLAY? (I see different warnings when testing on the local system if $DISPLAY is unset (does not exist in the current environement)).

jawed wrote:I tried replacing --with-gui to --without-gui although that didn't throw any error but didn't generate the output as well.
To be expected - calling verbs via command line arguments doesn't work in combination with '--without-gui'.

jawed wrote:Now my question whether it is possible to run the same command (--with-gui) in Linux ?
Yes - if you install e.g. Xvfb on the server, adjust $DISPLAY for this virtual frame buffer, and use the command as is.

(See also e.g. this earlier topic: Re: Command line --verb options do not seem to work)

jawed
Posts: 5
Joined: Fri Jul 13, 2012 1:14 am

Re: Problem in re-writing a command for Linux

Postby jawed » Tue Oct 09, 2012 11:38 pm

I am very thankful of your detailed response. In case If I install that X Server(Xvfb) on Linux work station would you please tell me how much resource that might have consumed? I mean would it be a feasible option If more than 1000 user run that script daily?

Thanks
Jawed Islam

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Problem in re-writing a command for Linux

Postby ~suv » Tue Oct 09, 2012 11:49 pm

jawed wrote:In case If I install that X Server(Xvfb) on Linux work station would you please tell me how much resource that might have consumed? I mean would it be a feasible option If more than 1000 user run that script daily?
Unfortunately I can't help with this follow-up question (I don't run/maintain web servers myself, and only briefly tested inkscape with Xvfb on my local system (as proof-of-concept) last time this question came up on the irc channel (see link to earlier topic in previous reply)). You might get better-informed answers if asking in a forum (or mailing list) dedicated to setting up and running linux-based web servers…

jawed
Posts: 5
Joined: Fri Jul 13, 2012 1:14 am

Re: Problem in re-writing a command for Linux

Postby jawed » Wed Oct 10, 2012 12:10 am

Thanks a lot mate for your replies, that really helped me out to find the ways of moving forward.

jawed
Posts: 5
Joined: Fri Jul 13, 2012 1:14 am

Re: Problem in re-writing a command for Linux

Postby jawed » Wed Oct 10, 2012 1:18 am

Well as I have installed Xvfb successfully but am still getting the same error so the problem is probably with DISPLAY. So would you please refer me any resource which can help me out in adjusting the DISPLAY for inkscape?

Thanks
Jawed Islam

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Problem in re-writing a command for Linux

Postby v1nce » Wed Oct 10, 2012 6:39 pm

maybe you can inkscape in a "broadway" context (rendering is not done in a X11 windows but in a html5 browser)

http://blogs.gnome.org/alexl/2011/03/15 ... nd-update/

As it is not rendered in a X11 windows if could remove the need for x11 (not sure it will).
Not sure about perfs anyway.
If (ever) it works it would be very experimental. xvfb looks way more safe.


Return to “General Discussions”