Sabtu, 27 Maret 2021

Cara auto print dengan javascript dan disable dialog printer pada browser

auto print tanpa konfirmasi biasanya dibutuhkan untuk aplikasi kasir yang berbasis web,

jadi kasir bisa lebih cepat melayani customernya 👍

Langsung saja, caranya gampang banget

 

tambahkan javascript berikut di aplikasi web kita

            window.print();

            atau           

            window.onload=function(){self.print();}

FIREFOX

  • In the address bar of Firefox, type about:config

  • Search for print.always_print_silent and double click it

  • Change it from false to true

CHROME

Check this and follow the steps:

  1. Launch Chrome and check that the Chrome Version is at the latest version (18.0.1 or higher )
  2. Type about:flags in the address bar and ensure that the Disable Print Preview flag is NOT enabled (Print preview must be enabled for Kiosk Printing to work) 
  3. Close the browser
  4. Find the browser shortcut on your desk top, right click and select 'properties'
  5. Append the following text to the end of the target field: -kiosk-printing atau -kiosk -kiosk-printing (It should now load in full screen (kiosk) mode)
  6. Save, and launch Google Chrome.
  7. The print preview will appear on your screen, but will instantly print a receipt to your default printer.
setelah disetting seperti itu, otomatis browser akan print ke default printer tanpa dialog konfirmasi.

Semoga bermanfaat

 

Referensi:

https://stackoverflow.com/questions/9213660/html-javascript-one-click-print-no-dialogs

https://windowsreport.com/chrome-system-print-dialog/

https://stackoverflow.com/questions/21073959/print-without-confirmation-on-google-chrome




1 komentar: