Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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.

Solution 2:

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

Solution 3:

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

Solution 4:

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

Solution 5:

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.

Post a Comment for "Print A Page On Local Using Php (javascript) Without Windows Print Dialog Box"