converting svg to eps via commandline

Hello,
I'd like to convert a bunch of my svgs to eps-format automatically via the commandline. I noticed that there is no option like the one for exporting png but I found
------ -p PRINTER, --print=PRINTER
Print document(s) to the specified printer using `lpr -P PRINTER'. Alternatively, use `| COMMAND' to specify a different command to pipe to, or use `> FILENAME' to write the PostScript output to a file instead of printing. Remember to do appropriate quoting for your shell, e.g.
inkscape --print='| ps2pdf - mydoc.pdf' mydoc.svg ------
in the man-page which seems to come close. What do I have to do to get eps on a windows-system?
thanks and best regards, Steffen

On Sun, 2005-01-23 at 19:01 +0100, Steffen Glückselig wrote:
I'd like to convert a bunch of my svgs to eps-format automatically via the commandline. I noticed that there is no option like the one for exporting png but I found
-p PRINTER, --print=PRINTER
Print document(s) to the specified printer using `lpr -P PRINTER'. Alternatively, use `| COMMAND' to specify a different command to pipe to, or use `> FILENAME' to write the PostScript output to a file instead of printing. Remember to do appropriate quoting for your shell, e.g.
inkscape --print='| ps2pdf - mydoc.pdf' mydoc.svg
in the man-page which seems to come close. What do I have to do to get eps on a windows-system?
Well, internally the difference between printing or saving postscript and saving as EPS is a matter of how the bounding box is placed. It is something that could be done by hand somewhat easily.
It would be a really cool feature if someone implemented a command line option to the Extensions system to allow for batch conversion between any supported formats. It would be an easier enhancement for someone who wanted to get familiar with the codebase. There wouldn't be any GUI programming, or using lots of the codebase that would be required. I would be happy to help anyone that wanted to do this, it is an oft requested feature.
--Ted

Up spake Ted Gould:
It would be a really cool feature if someone implemented a command line option to the Extensions system to allow for batch conversion between any supported formats.
Here you go. It's in GNU Make format (should work with other Maken).
.SUFFIXES: .svg .ps .png .eps .pdf .svg.ps: inkscape -p '> $@' $< .svg.png: inkscape -d 72 -e $@ $< .ps.eps: ps2eps -l -f $< || ps2epsi $< $@ .ps.pdf: ps2pdf $<
Save that to "foo.mk". To convert a single file "bar.svg":
make -f foo.mk bar.eps
Or to convert all files in the current directory:
for i in *.svg; do make -f foo.mk ${i%svg}eps done
I realize this doesn't help Windows users much. Sorry. I *have* done this sort of thing on Windows, but it requires a *lot* of mucking about; presumably if you wanted that sort of thing, you wouldn't be on Windows.

Up spake Steffen Glückselig:
.ps.eps: ps2eps -l -f $< || ps2epsi $< $@
Would you, shortly, elaborate on that cryptic line?
This is a 'suffix rule', defining the conversion from .ps to .eps.
$< expands to the input (.ps) file. $@ expands to the output (.eps) file.
The rule first tries ps2eps. If that doesn't work (e.g. if ps2eps isn't installed), it tries ps2epsi.
Under Debian, ps2epsi is provided by gs-common (i.e. ghostscript). I don't have ps2eps installed anymore, so I'm not sure what provides it.

Hello Trent,
So inkscape -p '> $@' $< is used to convert a svg to ps. And then ps2eps -l -f $< || ps2epsi $< $@ is called to get the eps?
thanks, Steffen

Up spake Steffen Glückselig:
So inkscape -p '> $@' $< is used to convert a svg to ps. And then ps2eps -l -f $< || ps2epsi $< $@ is called to get the eps?
Precisely. The advantage of make is that you merely describe how to perform each step. Then ask for the result, and it will work out the order of steps (usually correctly).
participants (3)
-
Steffen Glückselig
-
Ted Gould
-
Trent Buck