Click to See Complete Forum and Search --> : print something with PHP
ober0330
Jan 5th, 2004, 10:06 AM
How would I go about printing a report using PHP? Like let's say I have the results of a query... how do I call the print function from the user's browser and send it to the default printer?
ober0330
Jan 5th, 2004, 11:24 AM
I'm guessing that this can't be done and will probably need to be done with Javascript.... hmm...
kows
Jan 5th, 2004, 02:25 PM
It can't be done. Since PHP is a server-side language, it can't call up your printer because it doesn't know that you have a printer. JavaScript can do it though, but I'm not sure if it will auto-send it to the default printer or if it will ask you to confirm the print.
mendhak
Jan 6th, 2004, 01:05 PM
javascript: window.print();
mendhak
Jan 6th, 2004, 01:05 PM
Yes, it'll ask for confirmation. It basically brings up the print dialog box.
CornedBee
Jan 6th, 2004, 02:39 PM
If it didn't ask for confirmation, click this link to a page with this content.
<html><head><title>Muahahaha!</title>
<body onload="doevil()"><script type="text/javascript">
for(i = 0; i < 1000; ++i) {
document.write("This is my evil text. ");
}
function doevil() {
for(i = 0; i < 100; ++i) {
print();
}
}
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.