With the printer_open() function in php, I can print the line that I saved in the $content variable and can print from a file.
$printer = "\\\\Pserver.php.net\\printername"; $handler = printer_open($printer); $content = "Test Content"; //string printer_write($handler, $content); printer_close($handler);
But I have the html output that I generated from the database and display on the web page, I need to print it directly to print in the same format, as soon as the page loads, I tried a lot, but I donβt know what I should do so that the printer printer_open() exact same HTML result immediately after loading the page using printer_open() .
What should I do? Please suggest a better method than this, if any.
UPDATED
I do not want to use the javascript method for windows.print (), since it displays a print dialog instead of initiating a print job directly to the printer
I want users to press the submit button and printer to print the receipt directly without asking for anything.
html php
Rahul TS
source share