La verdad no se como seguir, tengo el siguiente código que en teoría es ZPL:
Código:
^XA
^FO^60,60^BKN,N,100,Y,A,A^MD27.9~SD27.9^FD1234587^FS
^FO^10,170^A0,22,20^MD27.9~SD26^FD XXXXX ^FS
^FO^10,190^A0,22,20^MD27.9~SD26^FD XXXXX ^FS
^FO^10,190^A0,22,20^MD27.9~SD26^FD XXXXX ^FS
^JUS
^XZ
Las XXXXXX representan los datos que debo remplazar dinamicamente según lo que obtengo de la DB pero no logro enviar esto a la impresora, copio y pego en un block de notas, Ctrl + P y me dice página demasiado pequeña y bla bla bla...
utilice la siguiente función
Código:
function WriteRawDataToPrinter(PrinterName: String; Str: String): Boolean;
var
PrinterHandle: THandle;
DocInfo: TDocInfo1;
i: Integer;
B: Byte;
Escritos: DWORD;
begin
Result:= FALSE;
if OpenPrinter(PChar(PrinterName), PrinterHandle, nil) then
try
FillChar(DocInfo,Sizeof(DocInfo),#0);
with DocInfo do
begin
pDocName:= PChar('Printer Test');
pOutputFile:= nil;
pDataType:= 'RAW';
end;
if StartDocPrinter(PrinterHandle, 1, @DocInfo) <> 0 then
try
if StartPagePrinter(PrinterHandle) then
try
while Length(Str) > 0 do
begin
if Copy(Str, 1, 1) = '\' then
begin
if Uppercase(Copy(Str, 2, 1)) = 'X' then
Str[2]:= '$';
if not TryStrToInt(Copy(Str, 2, 3),i) then
Exit;
B:= Byte(i);
Delete(Str, 1, 3);
end else B:= Byte(Str[1]);
Delete(Str,1,1);
WritePrinter(PrinterHandle, @B, 1, Escritos);
end;
Result:= TRUE;
finally
EndPagePrinter(PrinterHandle);
end;
finally
EndDocPrinter(PrinterHandle);
end;
finally
ClosePrinter(PrinterHandle);
end;
end;
intente hacer un hola mundo utilizando
Código:
WriteRawDataToPrinter('Mi impresora','Hola mundo');
pero ni la tos, la muy desvergonzada se me ríe en la cara... Alguna OPCIÓN?? AYUDA!! HELP!!