Printing receipt without prompt


#1

Good morning,

I’m new at wappler and still evaluating if is the tool I need for an specific project.

Is it possible to print a receipt from a website created with wappler without the system prompt for printer and configuration options? Just to click and print?

Thanks in advance


#2

Hi Manuel and welcome to Wappler Community!

You can use the window.print() method attached to a button on your page. However, it’s not possible to directly print, without showing a dialog asking users to select their printer and print options. It’s also not a good idea to do that, without asking the users to confirm. This is a security measure to protect users from rogue scripts.

Learn more about window.print() method here: https://www.w3schools.com/jsref/met_win_print.asp


#3

you could do what i did and connect the printer to the server and print from the server with PHP and a command line tool to print HTML files.


#4

Thanks to both,

I’ll give it a shot and see what I can do, as I need to print receipts and if the user has to click on the prompt it would be a waste of time in this case. I know the security issue this presents but is part of the project requirement.

I’ll let you know if I find out how to do it.

Thanks!