PHP 5中的服务器端打印

How can i print my html file via php script? I just want to run it in background without any prompt. I have read other posts regarding this but still didnt find anything working. I tried this one :

<?php
$dir = "temp"; // the folder that you are storing the file to be printed
$file = "file.html"; //change to proper file name
$file_dir = $dir.$file;
$server = "home_computer"; //name of the computer you are printing to on your network
$printer = "HP"; //printers shared name
$command = "print $file_dir /d:\\$server\\$printer";
exec($command) or die("File failed to print");
?>

got this example here http://www.phpfreaks.com/forums/index.php/topic,207946.0.html

here is what i got working :

$html = "testing print";
$handle = printer_open();
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, $html);
printer_close($handle);

We require php_printer.dll php extension to make this work in php5. :)

You can't print html pages with php. Php is a server-side language, it runs on the server.

The printer is on the client's machine. Meaning you'll need a client-side language to accomplish this.

If you want to print the source code then it should be be doable by writing a program that prints the passed string and then calling it via a system call. On windows it appears to have an extension for that.

If you want to print a rendered version, then you have to know that for that you need some kind of a rendering engine. While not impossible its probably more work than what you want to get into.