Codigo para imprimir etiquetas en impresora termica TSC multiples grupos usando PHP
$page = $_SERVER['PHP_SELF'];$sec = "1";header("Refresh: $sec; url=$page");//$handle = fopen("PPP", "w+");//Sergio Zegarra$fecha = date('Y-m-d H:i:s');sleep(1);$a = rand(0, 9);echo "CODIGO IMPRESO: ".strtotime($fecha);if(($handle = @fopen("\\\\127.0.0.1\\termi", "w+")) === FALSE){die('No se puedo Imprimir, Verifique su conexion con el Terminal');}fwrite($handle, "SIZE 94 mm,40 mm". PHP_EOL);//fwrite($handle, "AUTODETECT". PHP_EOL);//fwrite($handle, "GAP 2.5 mm,0 mm". PHP_EOL);fwrite($handle, "SPEED 4". PHP_EOL);fwrite($handle, "DENSITY 4". PHP_EOL);fwrite($handle, "DIRECTION 0". PHP_EOL);fwrite($handle, "CLS". PHP_EOL);fwrite($handle, 'TEXT 10,10,"9",90,1,1,"Universidad de Leyes Divinas"'. PHP_EOL);//fwrite($handle, "REVERSE 0,5,760,300". PHP_EOL);fwrite($handle, 'TEXT 220,10, "2",90,1,1, "UNIVERSIDAD DE LEYES"'. PHP_EOL);fwrite($handle, 'TEXT 190,10, "2",90,1,1, " DIVINAS"'. PHP_EOL);fwrite($handle, 'BARCODE 160,27, "128",80,2,90,2,2, "'.strtotime($fecha).$a.'"'. PHP_EOL);fwrite($handle, 'TEXT 44,20, "1",90,1,1, " CODIGO PARA CERTIFICADO"'. PHP_EOL);fwrite($handle, 'TEXT 24,10, "2",90,1,1, " Informes: 989007909"'. PHP_EOL);fwrite($handle, 'TEXT 480,10, "2",90,1,1, "UNIVERSIDAD DE LEYES"'. PHP_EOL);fwrite($handle, 'TEXT 450,10, "2",90,1,1, " DIVINAS"'. PHP_EOL);fwrite($handle, 'BARCODE 420,27, "128",80,2,90,2,2, "'.strtotime($fecha).$a.'"'. PHP_EOL);fwrite($handle, 'TEXT 305,20, "1",90,1,1, " CODIGO PARA CERTIFICADO"'. PHP_EOL);fwrite($handle, 'TEXT 285,10, "2",90,1,1, " Informes: 98900909"'. PHP_EOL);fwrite($handle, 'TEXT 740,10, "2",90,1,1, "UNIVERSIDAD DE LEYES"'. PHP_EOL);fwrite($handle, 'TEXT 715,10, "2",90,1,1, " DIVINAS"'. PHP_EOL);fwrite($handle, 'BARCODE 690,27, "128",80,2,90,2,2, "'.strtotime($fecha).$a.'"'. PHP_EOL);fwrite($handle, 'TEXT 575,20, "1",90,1,1, " CODIGO PARA CERTIFICADO"'. PHP_EOL);fwrite($handle, 'TEXT 555,10, "2",90,1,1, " Informes: 989100909"'. PHP_EOL);fwrite($handle, "PRINT 1". PHP_EOL);fclose($handle); // cierra el fichero PRN//$salida = exec('copy PPP LPT1'); //lpr->puerto impresora, imprimir archivo PRN?>
No hay comentarios:
Publicar un comentario