Ver Mensaje Individual
  #8  
Antiguo 06-12-2011
Avatar de ethangio
ethangio ethangio is offline
Miembro
 
Registrado: jul 2008
Posts: 63
Reputación: 18
ethangio Va por buen camino
No he podido conseguir que corte el papel, sigue imprime los caracteres ascii correspondientes ...
Miren encontré este ejemplo en el foro
enviandole como parametros, el nombre de la impresora ya sea local o en red y la cadena pero la cadena con la que corta es esta
\x1B@\x0A\x0D\x1Bi\x0A\x0D
.... Pero por que no quiere cortar con #27 # 109 o #105

Código Delphi [-]
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;

Dejo la liga por si alguien le sirve asi :
http://delphi.jmrds.com/?q=node/50

y este

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

En el segundo esta el codigo ..
Responder Con Cita