printer_write()
| From: | Michael Eaton | Date: | Mon, 17 Dec 2001 20:16:39 +0000 |
| Subject: | printer_write() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77994@lists.php.net to get a copy of this message | ||
Hello php-general,
I can print directly from the server, but from the script page I get "Warning: couldn't
allocate the printerjob in <code line whatever>. I'm using php version 4.06 on Win2000
Advanced Server. Code sample...
<?
$DATA = array("Test Header", "Test Page");
//dump list of local printers know to machine
$PRINTERS = printer_list(PRINTER_ENUM_LOCAL);
foreach($PRINTERS as $key=>$val) {
foreach($val as $sub_key=>$value) {
echo $sub_key.": ".$value."<br>";
}
}
?>
<p>
<?
// do the actual printing work
$printer = "\\\\<net node>\\<printer>";
echo "printer: ".$printer."<br>";
$handle = printer_open($printer);
foreach($DATA as $val) {
printer_write($handle, $val);
echo $val."<br>";
}
printer_close($handle);
?>
--
Best regards,
Michael mailto:michael.eaton@expresscomputersupply.com