Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print a page on local using php (javascript) without Windows print dialog box

I am developping an intranet for a shop. I need to print a receipt by clicking a submit button on php page. I do not want to see Windows print dialog box.

how can I do this. I need some advise

I will use Windows XP, I have full control of the system which this application will be running, Any application/plugin/exploits etc can be installed or used to help with removing the print dialog box.

Regards

like image 377
eMRe Avatar asked Nov 02 '10 12:11

eMRe


People also ask

How can I Print Javascript without displaying the Print dialog box?

Simply assign the desired printer as the default printer in Windows and make sure you're using the Chrome Engine under the browser settings (the default setting). Then call window. print(); and that's it!

How do I Print directly from the browser without popping up a pop up window?

You just need to call Print() itself, instead of window. print() in the onclick event.


1 Answers

I do this with my shop order system written in PHP and it uses a print dialog via jquery. you can bypass the firefox print dialog by using the about:config page.

  • Open firefox and put about:config in the address bar and press enter (you will need to click the button that shows to say you know what you're doing)
  • Type print.always_print_silent in the filter box at the top If you have an entry already there and it is set to false just right click it and choose 'toggle' to set it to true. If there is no entry there already then follow on...
    • right click the screen and choose New->boolean
    • enter print.always_print_silent as the preference name when asked and press enter
    • set boolean value to true and press enter

That's it, you will no longer see the dialog box when you print. Beware though, it will try to print to the last printer you used when you had the dialog box open. If you ever need to change it then you will need to toggle the value for print.always_print_silent by following the above steps.

like image 118
CommentLuv Avatar answered Sep 27 '22 22:09

CommentLuv