Select a printer and silently print

后端 未结 4 928
既然无缘
既然无缘 2020-12-01 08:31

This answer shows how to enable silent printing in Google Chrome. However, I have two web pages which have to be silently printed using two different printers without furthe

4条回答
  •  眼角桃花
    2020-12-01 09:05

    I have searched for an answer but it looks like there is no way to set a printer programatically. Therefore my probably complicated solution:

    Create a command line application which can switch the default printer of the operating system. Maybe an application which is capable of disabling and enabling a printer. If you are on Windows a .NET application could probably do this. If on Linux there should be a command line interface for printer management (I don't know for sure).

    Now make for example a PHP, asp.net or ruby etc. page which is able to call the printer enable/disable program.

    If this is working you can use Javascript calls to first print to printer one and after the switch to printer two. However there some disadvantages:

    • If printer one is printing a document you can not switch to printer two, since this will disable printer one. So somehow you should time how long a common job takes.
    • There is a lot of overhead in this solution. You need to made extra calls for the switch between printers
    • Maintainability is absolutely not optimal since you need to maintain the printer switch program and the webservice.

    I hope for you someone comes up with a better solution, but I wanted to at least share my thoughts. Maybe they help you in solving your problem.

提交回复
热议问题