Print document to printer without user interaction

Asked

Viewed 157 times

1

I need to print a document by sending directly to the printer without the user having to choose the printer. How do I do this with PHP5 or JavaScript?

I found that with JavaScript has the possibility to do with window.print, but then opens the print screen to select the printer, which is not what I want.

  • The application runs on the same network as the printer?

  • Depending on the printer, you can try a more elaborate solution with Google Cloud Print. Depends on printer support, https://github.com/yasirsiddiqui/php-google-cloud-print

  • In case you are on the same network and have knowledge about CUPS (native Linux print server), you can try to configure CUPS and send the requests directly to it. http://www.nongnu.org/phpprintipp/

1 answer

0

Not possible using Javascript and PHP only.

In Firefox, there is a forever print configuration when invoked the window.print() method. - Access about:config - Create a new Boolean preference with the print.always_print_silent name and mark it as true.

After restarting the browser, any call via Javascript with window.print() code will automatically start printing.

Remembering that this preference will apply to any site that invokes the said method.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.