Tuesday, November 3, 2015

Print directly from browser without print popup dialog window

Print directly from browser without print popup dialog window

I wanted to follow up on this to share how I resolved this.

I ended up implementing a custom application that works very similar to the Nexus Mod Manager. I wrote a C# application that registers a custom Application URI Scheme. Here's how it works:

1. User clicks "Print" on the website.
2. Website links user to "CustomURL://Print/{ID}
3. Application is launched by windows via the custom uri scheme.
4. Application communicates with the pre-configured server to confirm the print request and in my case get the actual print command.
5. The application then uses the C# RawPrinterHelper class to send commands directly to the printer.

This approach required an initial download from the user, and a single security prompt from windows when launching the application the first time. I also implemented some Javascript magic to make it detect whether the print job was handled or not. If it wasn't it asks them to download the application.



No comments: