i want to print the bill to printer from php mysql database?
is it possible?
help me please!!!!!
PHP is a server-side scripting language. If you need to control printing, that's going to be handled client side. For example, you can include a button on your page, or an icon of a printer that lauches the printer controls of the user's PC. What you need to do is display the page accordingly so it's layout is printer friendly. You do that by appying the appropriate styles. You can use the @media rule to set the layout printer friendly.
Hi as JorgeM said you need a js for it to be done...my suggestion is
on page load
<html> <head> </head> <body onload="window.print()"> <?php DATA FROM DB ?> </body> </html>
or using an image or button
<html> <head> </head> <body> <?php DATA FROM DB ?> <img src="printer.png" width="28" height="28" onclick="window.print()" /> <input type="button" value="Print this page" onclick="printpage()"> </body> </html>
i have tried
<input type="button" value="Print this page" onclick="printpage()">
but it shows no output
and when i use
<img src="printer.png" width="28" height="28" onclick="window.print()" />
its open printer diup box, if is good for laser printer/color printer, but it cteate problem for DMP printer i want solution for DMP printer
Unless you have defined a
window.print(), you could change the button to use the same thing:
<input type="button" value="Print this page" onclick="window.print()">
As for problems with a dot-matrix printer, those aren't going to be resolved by anything you can do in the browser. The print dialog opened by
window.print() is the browser's print dialog the same as if the user chose to print the page themselves. What problems exactly are you encountering?
here i have a problem..
i want to print a page in php with image, but image is not print..
please help somebuddy..
@Lokesh_4 open a new thread, explain the issue and show the code.
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.