I am generating a file in PHP with the commands in ZPL and sending to the printer via the lpr -P
linux command, the problem is that the printer is printing the commands that are in the file and not the formatted label.
Anyone have any idea what might be going on?
Follow used code!
$ lc_name = 'rel_label.prn'; $ lc_handle = fopen ($ _ SERVER ['DOCUMENT_ROOT']. '/ tmp /'. $ lc_name, 'w +');
/ * if (empty ({tags_by_item}) || {tags_by_item == 0}) { {label_by_item} = 1; } * /
// var_dump ([total_selected]);
for ($ x = 0; $ x
$ line = explode ('#', [total_selected] [$ x]);
fputs ($ lc_handle, '^ XA');
fputs ($ lc_handle, '^ MMT');
fputs ($ lc_handle, '^ PW831');
fputs ($ lc_handle, '^ LL0240');
fputs ($ lc_handle, '^ LS0');
fputs ($ lc_handle, '^ FX Product Column 1');
$ nombre_item = '^ FT40,60 ^ A0N, 40,30 ^ FD'. $ line [0]. '^ FS'; fputs ($ lc_handle, $ name_item);
$ codigo_item = '^ FO40,80 ^ BC ^ FD'. $ line [1]. '^ FS'; fputs ($ lc_handle, $ code_item);
fputs ($ lc_handle, '^ PQ1,0,1, Y ^ XZ'); fputs ($ lc_handle, '^ XA ^ ID000.GRF ^ FS ^ XZ'); fputs ($ lc_handle, '^ XA ^ ID001.GRF ^ FS ^ XZ');
}
fclose ($ lc_handle);
echo '====='. $ items. '=====';
// $ file = 'open'; $ lc_file = $ _SERVER ['DOCUMENT_ROOT']. '/ tmp /'. $ lc_name; // $ command="lpr -P". {PRINTER}. "". $ lc_arquivo; $ command="lpr -P". zebra "". $ lc_arquivo;
// var_dump ($ command);
exec ($ command);