Enviar arquivo TXT ´para impressora Zebra
Help, como faço para essa rotina enviar o arquivo criado para impressora zebra?
<?php
$c1 = $_POST['c1'];
$c2 = $_POST['c2'];
$c3 = $_POST['c3'];
$c4 = $_POST['c4'];
$c5 = "$c1/$c3/$c4";
//echo $c5;
$abbre = fopen("arquivo.txt" , "w+");
fwrite($abbre, "I8,A,001". "\r\n");
fwrite($abbre, "Q400,024". "\r\n");
fwrite($abbre, "q863". "\r\n");
fwrite($abbre, "rN". "\r\n");
fwrite($abbre, "S3". "\r\n");
fwrite($abbre, "D7". "\r\n");
fwrite($abbre, "ZT". "\r\n");
fwrite($abbre, "JF". "\r\n");
fwrite($abbre, "O". "\r\n");
fwrite($abbre, "R231,0". "\r\n");
fwrite($abbre, "f100". "\r\n");
fwrite($abbre, "N". "\r\n");
fwrite($abbre, "A63,353,0,3,1,2,N,");
fwrite($abbre, '"');
$abbre = fopen("arquivo.txt" , "a+");
fwrite($abbre, $c1);
fwrite($abbre, '"'. "\r\n");
fwrite($abbre, "A17,10,0,3,2,2,N,");
fwrite($abbre, '"');
$abbre = fopen("arquivo.txt" , "a+");
fwrite($abbre, $c2);
fwrite($abbre, '"'. "\r\n");
fwrite($abbre, "B43,123,0,1,2,6,160,B,");
fwrite($abbre, '"');
$abbre = fopen("arquivo.txt" , "a+");
fwrite($abbre, $c5);
fwrite($abbre, '"'. "\r\n");
fwrite($abbre, "P1". "\r\n");
fclose($abbre);
/* Arquivo gerado em EPL, linguagem nativa da Impressora Zebra GC420t
I8,A,001
Q400,024
q863
rN
S3
D7
ZT
JF
O
R231,0
f100
N
A63,353,0,3,1,2,N,"100765"
A17,10,0,3,2,2,N,"Produt A"
B43,123,0,1,2,6,160,B,"100765/34/preto"
P1
*/
// Enviar para impressora
/* erro na função printer_open();
// opção 1
if($printer = printer_open("\\\\192.168.0.102\\zebraCG420t")){
printer_set_option($printer, PRINTER_MODE, "raw");
$font = $printer_create_font("arial",23,13,PRINTER_FW_ULTRABOLD, false, false, false, 900);
$printer_select_font($printer, $font);
$strs - file_get_contents("arquivo.txt");
printer_write($printer,$strs);
printer_close($printer);
}
*/
// opção 2 - Erro função sysshell()
//sys_shell("copy arquivo.txt USB001"); // aqui está com erro
echo "Etiqueta Impressa";
Discussão (0)
Carregando comentários...