5

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

eMRe
  • 3,097
  • 5
  • 34
  • 51
  • Due to Javascript sandboxing, I would not be surprised if what you are asking is impossible. – Hammerite Nov 02 '10 at 12:58
  • 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. – eMRe Nov 02 '10 at 14:14

5 Answers5

9

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.

CommentLuv
  • 1,079
  • 1
  • 9
  • 14
  • Omg Tanks so much for this answer. Should I upvote this 10 times? I works perfectly on FF9.x. Just one backdraw is that you cannot change printer anymore for that page but to setting this key to false, setting up the new printer, and then to true again. Also, not tested, but it may lead to undesirable effect if for any reason a malicious site send print events to your browser.:( – Paulo Bueno Jan 11 '12 at 13:05
5

You can't bypass the print dialog, advertisers would be printing out flyers to your printer if this was possible.

Nick Craver
  • 623,446
  • 136
  • 1,297
  • 1,155
2

Javascript can only trigger the print function with window.print(), but cannot change the way the browser works.

Harmen
  • 22,092
  • 4
  • 54
  • 76
0

You can't simply pass the pring dialog. I'm not aware of such functionality but could be possible using JAVA.

Z. Zlatev
  • 4,757
  • 1
  • 33
  • 37
0

Assuming you have the printer attached to the server, you can render the receipt/document to a PDF file, write it to a temporary directory and use the 'shell_exec' function to print it. The shell_exec function executes commands from the command line. Since Windows has something called a command line, it can be usefull.

Be aware that you need a program or batch file installed that can print a PDF from the command line. Such batch file can be found here.

TheGrandWazoo
  • 2,879
  • 1
  • 17
  • 15