我正在用PHP创建一个程序来打印.zpl
文件,我想知道是否有人知道我可以使用哪个命令来打印?
因为我已经完成了整个程序,所以它只是不打印。
echo "<script>alert('CODIGO INSERIDO');</script>";
$l1 = 'CT~~CD,~CC^~CT~';
$l2 = '^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR4,4~SD15^JUS^LRN^CI0^XZ';
$l3 = '^XA';
$l4 = '^MMT';
$l5 = '^PW900';
$l6 = '^LL0600';
$l7 = '^LS0';
$l8 = '^FT34,536^A0N,74,50^FH\^FD'; //QTD1
$l88 = '^FS';
$l9 = '^FT34,425^A0N,74,50^FH\^FD'; //QTD2
$l99 = '^FS';
$l10 = '^FT34,314^A0N,74,50^FH\^FD'; //QTD 3
$l100 = '^FS';
$l11 = '^FT177,536^A0N,74,48^FH\^FD'; //COD1
$l111 = '^FS';
$l12 = '^BY4,2,76^FT420,537^BEN,,Y,N';
$l13 = '^FD'; //BARRA1
$l133 = '^FS';
$l14 = '^FT33,201^A0N,74,50^FH\^FD'; //QTD4
$l144 = '^FS';
$l15 = '^FT177,425^A0N,74,48^FH\^FD'; //COD2
$l155 = '^FS';
$l16 = '^BY4,2,76^FT420,426^BEN,,Y,N';
$l17 = '^FD'; //BARRA2
$l177 = '^FS';
$l18 = '^FT364,89^A0N,74,48^FH\^FD'; //NF N
$l188 = '^FS';
$l19 = '^FT177,314^A0N,74,48^FH\^FD'; //COD3
$l199 = '^FS';
$l20 = '^BY4,2,76^FT420,315^BEN,,Y,N';
$l21 = '^FD'; //BARRA3
$l211 = '^FS';
$l22 = '^FT281,90^A0N,74,48^FH\^FD'; //NF
$l222 = '^FS';
$l23 = '^FT175,202^A0N,74,48^FH\^FD'; //COD4
$l233 = '^FS';
$l24 = '^BY4,2,76^FT418,202^BEN,,Y,N';
$l25 = '^FD'; //BARRA4
$l255 = '^FS';
$l26 = '^PQ1,0,1,Y^XZ';
$arquivo = fopen('etiqueta.zpl', 'w');
fwrite($arquivo, $l1);
fwrite($arquivo,"\n");
fwrite($arquivo, $l2);
fwrite($arquivo,"\n");
fwrite($arquivo, $l3);
fwrite($arquivo,"\n");
fwrite($arquivo, $l4);
fwrite($arquivo,"\n");
fwrite($arquivo, $l5);
fwrite($arquivo,"\n");
fwrite($arquivo, $l6);
fwrite($arquivo,"\n");
fwrite($arquivo, $l7);
fwrite($arquivo,"\n");
fwrite($arquivo, $l8);
fwrite($arquivo, $qtd1);
fwrite($arquivo, $l88);
fwrite($arquivo,"\n");
fwrite($arquivo, $l9);
fwrite($arquivo, $qtd2);
fwrite($arquivo, $l99);
fwrite($arquivo,"\n");
fwrite($arquivo, $l10);
fwrite($arquivo, $qtd3);
fwrite($arquivo, $l100);
fwrite($arquivo,"\n");
fwrite($arquivo, $l11);
fwrite($arquivo, $cod1);
fwrite($arquivo, $l111);
fwrite($arquivo,"\n");
fwrite($arquivo, $l12);
fwrite($arquivo,"\n");
fwrite($arquivo, $l13);
fwrite($arquivo, $result1[BARRA]);
fwrite($arquivo, $l133);
fwrite($arquivo,"\n");
fwrite($arquivo, $l14);
fwrite($arquivo, $qtd4);
fwrite($arquivo, $l144);
fwrite($arquivo,"\n");
fwrite($arquivo, $l15);
fwrite($arquivo, $cod2);
fwrite($arquivo, $l155);
fwrite($arquivo,"\n");
fwrite($arquivo, $l16);
fwrite($arquivo,"\n");
fwrite($arquivo, $l17);
fwrite($arquivo, $result2[BARRA]);
fwrite($arquivo, $l177);
fwrite($arquivo,"\n");
fwrite($arquivo, $l18);
fwrite($arquivo, $nf);
fwrite($arquivo, $l188);
fwrite($arquivo,"\n");
fwrite($arquivo, $l19);
fwrite($arquivo, $cod3);
fwrite($arquivo, $l199);
fwrite($arquivo,"\n");
fwrite($arquivo, $l20);
fwrite($arquivo,"\n");
fwrite($arquivo, $l21);
fwrite($arquivo, $result3[BARRA]);
fwrite($arquivo, $l211);
fwrite($arquivo,"\n");
fwrite($arquivo, $l22);
fwrite($arquivo, "NF");
fwrite($arquivo, $l222);
fwrite($arquivo,"\n");
fwrite($arquivo, $l23);
fwrite($arquivo, $cod4);
fwrite($arquivo, $l233);
fwrite($arquivo,"\n");
fwrite($arquivo, $l24);
fwrite($arquivo,"\n");
fwrite($arquivo, $l25);
fwrite($arquivo, $result4[BARRA]);
fwrite($arquivo, $l255);
fwrite($arquivo,"\n");
fwrite($arquivo, $l26);
fclose($arquivo);
$_SESSION['PrintBuffer']=$arquivo;
$handle = printer_open("CPD");
//printer_set_option($handle, PRINTER_MODE, "RAW");
//print $_SESSION['PrintBuffer'];
printer_write($handle, $_SESSION['PrintBuffer']);
printer_close($handle);