command line tool for print picture?

前端 未结 7 1262
终归单人心
终归单人心 2020-12-19 01:59

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

相关标签:
7条回答
  • 2020-12-19 02:39

    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"
    
    0 讨论(0)
  • 2020-12-19 02:43

    This link had a simpler solution:

    mspaint /pt [image filename]
    
    0 讨论(0)
  • 2020-12-19 02:48

    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.

    0 讨论(0)
  • 2020-12-19 02:49

    You can call ShellExecute from your program with print operation:

    ShellExecute(NULL,"print","c:\\test.png",NULL,NULL,SW_HIDE);
    
    0 讨论(0)
  • 2020-12-19 02:51

    I finally found out!

    use windows image and fax viewer.

    rundll32    shimgvw.dll    ImageView_PrintTo /pt   xxx.png   "printer name"
    
    0 讨论(0)
  • 2020-12-19 03:03
    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.

    0 讨论(0)
提交回复
热议问题