views:

199

answers:

3

My program need to print a curve, my solution is changing the curve into a picture, and this picture file (xxx.png) can be printed by using the default windows picture printing tool(right click the mouse on top of the file, and select print).

but I don't want user do this job manually, I need a command line tool to do this:

printPicture xxx.png

is there a tool like this?

ps: free/open source

edit: right click the file, and select "print", then I can print this file, How can I do it in command line ?

+1  A: 

IrfanView is able to do this. Here's a list of command line options for this application.

The following should work:

i_view32 xxx.png /print

If you want to print to a printer other than the default printer, specify the printer name:

i_view32 xxx.png /print="PrinterName"
Charlie Salts
I need to integrate this tool into my program, so ..
linjunhalida
"so..." what, exactly?
Carl Norum
You asked for a command line tool... that's what I've posted. How you use this in your application is up to you - you're the developer!
Charlie Salts
+1  A: 

You can call ShellExecute from your program with print operation:

ShellExecute(NULL,"print","c:\\test.png",NULL,NULL,SW_HIDE);
Carlos Gutiérrez
OMG! there is a "print" cmd...
linjunhalida
I use "print", but the result is wrong...
linjunhalida
A: 

I finally found out!

use windows image and fax viewer.

rundll32    shimgvw.dll    ImageView_PrintTo /pt   xxx.png   "printer name"
linjunhalida