printer扩展的一些使用疑问
<br />//phpinfo();exit;<br />//打印机的名字,并初始化<br />$handle = printer_open("EPSON LQ-735K ESC/P2");<br />$name = "麻花藤";<br />$address = "上海市虹梅路1801号";<br /><br />//转换格式,UTF8打出来乱码<br />$name = iconv("UTF-8", "GBK", $name);<br />$address = iconv("UTF-8", "GBK", $address);<br /><br />//手动设置纸张的长宽,但这步没启作用,纸张还是按照A4的大小在进行打印<br />printer_set_option($handle,PRINTER_PAPER_FORMAT,PRINTER_FORMAT_CUSTOM);<br />printer_set_option($handle,PRINTER_PAPER_WIDTH,320);<br />printer_set_option($handle,PRINTER_PAPER_LENGTH,250);<br /><br />//开启文档<br />printer_start_doc($handle, "Print"); // Name Document<br />//打印次数,其实上面printer_set_option也有参数,但也没起作用<br />for($i=1;$i<=2;$i++)<br />{<br /> printer_start_page($handle);<br /> printer_draw_text($handle, $name.$i.$i.$i,150,150);<br /> printer_draw_text($handle, $address.$i.$i.$i,250,250);<br /> printer_end_page($handle); //<br /><br /> //打印图片<br /> //printer_start_page($handle); // Start Logo<br /> //printer_draw_bmp($handle, "c:\\logo.bmp", 60, 0); // Logo Dir, lenght H , With V<br /> //printer_end_page($handle); // End Logo<br />}<br />printer_end_doc($handle); // Close document <br /><br /><br />printer_close($handle); // Close Pritner<br />