Search code examples
javascriptphpprintingprintersnetwork-printers

PHP & JavaScript select and setup printers


Printer selection

Take a look on the screenshot above, it's an Windows based app. I was wondering if this possible to done in PHP & JavaScript?

What I want to achieve is, user in module 1, will automatically select printer #1 and print it directly without display the print dialog. For module 2 will use printer #2.

I know this may sounds impossible due to security issue. But just share to me any possible solution that you know. Thank in advanced.

UPDATE: Feb 18, 2016 17:40

The module that I mention will actually generate a PDF file, I not sure if this matter.


Solution

  • Finally I have figured out the solution.

    1. I create a C# Windows Form application as a wrapper, by using CefSharp, then I load the web app inside
    2. From the Windows app, I can get the installed printers, and inject the list via JavaScript to the browser. Then it can be saved.
    3. For my case, I need to print out the downloaded pdf file directly, thus I use Foxit to print it out. (by running batch script in C# app)

    I have blog it down, refer here