Delphi printing to Zebra printer -
i have written function prints out zplii data zebra printer shown below
var st : string; startdocument(docname); startpage; try i:=0 datatoprint.count-1 begin st:=formatprintline(i); try escape(printerhandle,passthrough,length(st),pansichar(st),nil); except on e:exception begin getwin32apierrormessage(ferrorcode,ferrortext); raise eprinter.createfmt('printer write error %d'+#13+ 'while printing '+printername+#13+ errortext,[errorcode]); end; end; end; endpage; enddocument;
i have tested label data using command prompt print text file , label prints out correctly cannot print application. if pause printer can see job gets sent printer , size of job 2.12kb, size label should be, nothing prints out. light on zebra printer data lights nothing print. have tried 2 of zebra printers own, not printer issue. guess @ point maybe program isn't sending entire label data printer , end never received when trace through send request, everthing sent properly. printer shows job has 0/0 pages label cannot understand why not sending label. there special needs go @ end of label data besides ^xz termination character? using delphi xe3 if helps.
thanks everyone's able print labels using following changes:
st: ansistring; ... startdocument(docname); startpage; try i:=0 datatoprint.count-1 begin st:=formatprintline(i); try writeprinter(printerhandle,pchar(st),length(st),n); except on e:exception begin getwin32apierrormessage(ferrorcode,ferrortext); raise eprinter.createfmt('printer write error %d'+#13+ 'while printing '+printername+#13+ errortext,[errorcode]); end; end; end; endpage; enddocument;
i had change writeprinter instead of escape. escape did not print out after change st type ansistring writeprinter successful.
Comments
Post a Comment