Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Impresión (https://www.clubdelphi.com/foros/forumdisplay.php?f=4)
-   -   Impresora Térmica GK420t (https://www.clubdelphi.com/foros/showthread.php?t=81318)

MikyVato 02-11-2012 22:00:59

Impresora Térmica GK420t
 
Hola, he buscado por todos lados un ejemplo de como imprimir en la impresora Zebra GK420t pero NO, siempre ha fallado, se que debo armar un archivo txt y mandarlo directo a la impresora (¿es así?) bueno el archivo ya esta listo, ahora como lo envío? alguna ayuda por favor?? :confused:

ecfisa 02-11-2012 23:05:24

Hola MikyVato.

Por lo que he estado leyendo, las impresoras Zebra tienen comandos que no son compatibles con ESC/P2.
Los comandos propios de esta impresora los tenes aquí: Guía del usuario Zebra GK420t, busca por: Comandos ZPL. (pags. 107 ~ 112).

El el primer enlace aconsejan crear un archivo de texto con la configuración y luego enviarlo, pero supongo que también debería funcionar enviando los datos directamente a la impresora. Si deseas hacerlo de este modo, revisa si te sirve este enlace

Saludos.

MikyVato 05-11-2012 20:52:32

Gracias por tu tiempo, voy a probar las soluciones que me propones... cuando tenga una solución comparto el código

MikyVato 13-11-2012 21:57:03

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!!

MikyVato 13-11-2012 22:00:32

Me olvidaba la función y el código los obtuve del siguiente enlace

http://www.clubdelphi.com/foros/showthread.php?t=54626

Gracias!


La franja horaria es GMT +2. Ahora son las 10:56:16.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi