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 print
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"
This link had a simpler solution:
mspaint /pt [image filename]
I had a similar problem but I also needed way to control scaling (needed for barcode work) and always have the image centered.
I wrote an Open Source tool called ImagePrint to do just what you want. It's written in VB.Net as a console app. At the moment, it only prints to the default printer.
You can call ShellExecute from your program with print
operation:
ShellExecute(NULL,"print","c:\\test.png",NULL,NULL,SW_HIDE);
I finally found out!
use windows image and fax viewer.
rundll32 shimgvw.dll ImageView_PrintTo /pt xxx.png "printer name"
rundll32 C:\WINDOWS\system32\shimgvw.dll,ImageView_PrintTo "c:\mydir\my.bmp" "Fictional HP Printer"
This prints an image file (.png in my case) to a specified printer WITHOUT a dialog box popping up. Also... works without elevated command prompt privileges.