通过php使用打印机 [英] use printer via php
本文介绍了通过php使用打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Intranet中有四台计算机和一台打印机,并且在其中一台Windows计算机上安装了WAMP.现在,我想从窗口机器浏览器(或通过Ajax等)执行PHP脚本以打印数据.我需要知道有可能吗?如果是,那怎么办?
I have four computers and one printer in Intranet and I installed WAMP on one of Windows machines. Now I want to execute PHP script, from window machine browser (or via Ajax etc) to print data. I need to know will it be possible? if yes then how?
推荐答案
使用打印机功能:
<?php
$printer = "\\\\hostname\\printername");
if($ph = printer_open($printer)) {
$fh = file_get_contents('myfile.txt');
printer_set_option($ph, PRINTER_MODE, "RAW");
printer_write($ph, $content);
printer_close($ph);
} else {
echo "Can't connect to printer";
}
?>
这篇关于通过php使用打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文