开发者

Web Printing Multiple Printers

开发者 https://www.devze.com 2023-04-10 03:58 出处:网络
I\'m building a web application that is primarily ASP.NET MVC / Javascript. The application needs to be able to prin开发者_StackOverflowt certain content to a label printer and other content to a stan

I'm building a web application that is primarily ASP.NET MVC / Javascript. The application needs to be able to prin开发者_StackOverflowt certain content to a label printer and other content to a standard printer. I'd prefer for the user to be able to select a default printer for each one rather than having to always explicitly select a printer.

Is there a way to save and reload some sort of default printer settings for multiple printers in such an application. I am also open to using Silverlight for the p;rinting features if there is no way to do it via javascript.


Not via JavaScript, no; JS uses the browser's built-in print mechanism, which in turn defers to the OS's default print mechanism.


I know its been 6 years since this question was posted but since it wasn't answered here is what I believe is the best way to solve this issue.

You still cannot manipulate printers from a web browser, but there is a great choice out there called QZ Tray

You have to install a program that will communicate between javascript from your application and your configured printers, allowing you to send RAW printing commands and also HTML to any printer.

You can also print to multiple printers at once and save all printer configuration and parameters inside your web app, so you have full control over your printers.


Browsers do not allow javascript (or any script) to access information about the available set of printers or offer any means to select even a "prefered" printer.

Simliarly Silverlight does not support access to infomation about the set of printers available and does not allow printing API to select a specific printer to.

0

精彩评论

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

关注公众号