Windows: How to print a SVG using command line

Post questions on how to use or achieve an effect in Inkscape.
severus
Posts: 4
Joined: Sun Apr 13, 2008 5:27 am

Windows: How to print a SVG using command line

Postby severus » Sun Apr 13, 2008 6:04 am

Hi,

the command line howtos didn't help me in windows. I'm using 0.46 and I DO realize that it has some serious bugs concerning printing within windows.

Frankly, I could't care less which version I use. For a little private project (no money to gain :) I was announced "project leader" we need to get the generated Output-SVGs printed via a batch file. The program of choice would be inkscape because the template could be edited inside inkscape to get as close as possible to the desired output. But yes, it HAS to be windows because the output is generated by a database only existing in windows... (it's the way it was and there is no time to switch the database)

If we were to print it via firefox, the results would differ from what we had expected.

So, simply put: What is the correct syntax to print via the command line within windows? If this couldn't be done in inkscape 0.46 (don't have any problems printing via gui in standard settings), please specify the correct version to use. We tried different ways, the programmer gave up for now.

We tried:

"C:\program files\Inkscape\Inkscape.exe" -p "d:\folder\filename.svg"
and
"C:\program files\Inkscape\Inkscape.exe" -p "printer name" "d:\folder\filename.svg"
and
"C:\program files\Inkscape\Inkscape.exe" "d:\folder\filename.svg" -p "printer name"
and
"C:\program files\Inkscape\Inkscape.exe" "d:\folder\filename.svg" -p

Using Inkscape 0.46. Again: No printing problems within the GUI, no need to change anything in the settings.

It goes without saying that I tried the following:

1. Try to find an answer by searching the archives of the forum you plan to post to.
2. Try to find an answer by searching the Web.
3. Try to find an answer by reading the manual.
4. Try to find an answer by reading a FAQ.
5. Try to find an answer by inspection or experimentation.

PLEASE help.

Severus

User avatar
aho
Posts: 180
Joined: Sun Nov 04, 2007 9:51 am
Contact:

Re: Windows: How to print a SVG using command line

Postby aho » Sun Apr 13, 2008 8:27 am

Well, I don't have a printer, but you can try inkscapec.exe. With that thing you can at least see the error messages.

severus
Posts: 4
Joined: Sun Apr 13, 2008 5:27 am

Re: Windows: How to print a SVG using command line

Postby severus » Sun Apr 13, 2008 8:46 am

aho wrote:Well, I don't have a printer, but you can try inkscapec.exe. With that thing you can at least see the error messages.


I'll try. But couldn't you install http://www.pdfforge.org/ PDF creator and "print" a file? It's all about the syntax. No idea how it's supposed to work under windows.

Thank you for you tipp, I'll try. But @rest: Please don't file this thread under "closed". I will keep you posted if I have a solution. I still need an answer. Thank you very much for your help.

Update: I am getting nowhere.

According to http://inkscape.modevia.com/inkscape-man.html#examples

The Syntax is:

inkscape filename.svg -p '| lpr'

lpr is not recognized.

So I tried to specify the printername - WHATEVER I try (Port, IP, spoolername) it still is not working. I tried every possible way. I give up.

Unless someone gets me the correct syntax, I hereby declare: It is NOT possible. It's impossible to post here what versions I tried - it was pages and pages and pages of possible ways. I give up.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: Windows: How to print a SVG using command line

Postby microUgly » Mon Apr 14, 2008 10:11 am

Yah, I think you're in for a challenge. I'm not sure if you can use the commandline for printing from Inkscape under windows or not (all the documentation seems to rely on Linux specific commandline tools). I would look at using the commandline to export the SVGs to PNG then finding something to automate the printing of the PNGs.

severus
Posts: 4
Joined: Sun Apr 13, 2008 5:27 am

Re: Windows: How to print a SVG using command line

Postby severus » Mon Apr 14, 2008 4:39 pm

microUgly wrote:Yah, I think you're in for a challenge. I'm not sure if you can use the commandline for printing from Inkscape under windows or not (all the documentation seems to rely on Linux specific commandline tools). I would look at using the commandline to export the SVGs to PNG then finding something to automate the printing of the PNGs.


Uhm - no, not really. Does anyone know of a free program that couldprint svgs and render them better than firefox or Opera and can be used to print them w/o having t click on every file?

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: Windows: How to print a SVG using command line

Postby microUgly » Mon Apr 14, 2008 4:49 pm

So you don't need to automate it? I'm a little offended you didn't entertain my suggestion then, as batch printing is easy so long as you don't need to rely on the command line. It'll take two steps, as opposed to one though.

severus
Posts: 4
Joined: Sun Apr 13, 2008 5:27 am

Re: Windows: How to print a SVG using command line

Postby severus » Tue Apr 15, 2008 5:48 am

microUgly wrote:So you don't need to automate it? I'm a little offended you didn't entertain my suggestion then, as batch printing is easy so long as you don't need to rely on the command line. It'll take two steps, as opposed to one though.


Hi,

I am sorry I offended you. The problem being: The SVG only prints fine when using inkscape, but it always cuts of someting from the SVG, so the printing needed to be done manually. You see, it contains Text and other stuff. If opened in firefox [Update: Firefox 2!] and printed from, it gets ugly. We tried converting it to a bitmap using windows-tools and print it - it gets ugly. I have NO idea why that is (scaling, resizing?), but...

Update: In Firefox 3 Beta 5, we get beautiful results. So we can now print 4 SVGs a page w/o the need to convert them and it looks great, which is sufficient. We built htmls with 4 SVGs each so we could print them and go to a copyshop and let them cut all images at once. Thank you for your help, but we managed it -> The manpower needed to print via FF 3 is OK.

- > File closed :)

But could someone please update the manuals and special pages some of you made? Not EVERY command line argument works in windows. Printing from the commandline is not supported in Windows.

:idea:

It still is a nice program, but others should learn from my failure until it IS supported. I know the team lacks Windows developers and that you do it w/o payment, so this is not a rant. It's great this program exists at all.

Thank you and bye

Severus
Last edited by severus on Tue Apr 15, 2008 10:56 am, edited 3 times in total.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: Windows: How to print a SVG using command line

Postby microUgly » Tue Apr 15, 2008 10:24 am

severus wrote:We tried converting it to a bitmap using windows-tools and print it - it gets ugly. I have NO idea why that is (scaling, resizing?), but...

We tried it with the original SVG as a png using another program to convert it - it doen't look nice any more.

This may be because of what DPI you've used for the export. You can easily convert hundreds of SVG's to high resolution PNG's using the inkscape command line utility. Refer to the -d or --export-dpi= parameter. You want a DPI of 300 for print work.

If you have difficulty using Inkscape command line, you can try using Batik Rasteriser. It's a command line tool also so it'll be easy to script to convert many SVGs. And don't forget to specify the DPI. (an A4 image at 300 dpi should be 2490 pixels wide by 3510 pixels high)

The second step is to print them. My original suggestion was going to be to select all the PNG's in Windows Explorer, right-click and select print. That works but I'm not sure if it respect the image size or if it scales them to fit the page. If it doesn't I know with Photoshop you can easily select all your images and batch print them. I'm sure there's not shortage of free software that will be able to do this also. I'm pretty confident Picasa could do it.

User avatar
aho
Posts: 180
Joined: Sun Nov 04, 2007 9:51 am
Contact:

Re: Windows: How to print a SVG using command line

Postby aho » Tue Apr 15, 2008 8:27 pm

severus wrote:[...]
But could someone please update the manuals and special pages some of you made? Not EVERY command line argument works in windows. Printing from the commandline is not supported in Windows.
[...]


After some closer inspection I would say that it actually might work.

However, (and this is the big problem) lpr is a command line utility to talk with Unix network printers. You cannot access your local or networked Windows printers this way. Unless you're using some special software... and I only found commercial software for this task.

I also didn't find a similar program/rundll-call to talk with Windows printers in a similar fashion.

microUgly's workaround (png export, then printing) looks like the best option right now.

Baldo

Re: Windows: How to print a SVG using command line

Postby Baldo » Thu Jul 02, 2009 3:03 am

Some news ??

I have the same problem, one year last ...
How do you solve the problem ??

TKS
Baldo


Return to “Help with using Inkscape”