开发者

command line tool for print picture? [closed]

开发者 https://www.devze.com 2022-12-20 14:40 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
开发者_StackOverflow中文版

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 9 months ago.

Improve this question

My program needs 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

How can I do this in command line?


I finally found out!

use windows image and fax viewer.

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


This link had a simpler solution:

mspaint /pt [image filename]


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"


rundll32 C:\WINDOWS\system32\shimgvw.dll,ImageView_PrintTo "c:\mydir\my.bmp" "Fictional HP Printer"


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.


You can call ShellExecute from your program with print operation:

ShellExecute(NULL,"print","c:\\test.png",NULL,NULL,SW_HIDE);
0

精彩评论

暂无评论...
验证码 换一张
取 消