Ver Mensaje Individual
  #2  
Antiguo 16-06-2017
Avatar de _Leo
_Leo _Leo is offline
Miembro
 
Registrado: ene 2017
Ubicación: Lanzarote (Islas Canarias)
Posts: 38
Reputación: 0
_Leo Va camino a la fama
Hola, aunque Delphi no es lo mío, a ver si te funciona así:
Código Delphi [-]
function Write_RAW_StringToPrinter(PrinterName:String; comando:AnsiString): Boolean;
var
  PrinterHandle: THandle;
  N: DWORD;
  DocInfo1: TDocInfo1;
begin
  Result := False;
  if not WinApi.WinSpool.OpenPrinter(PChar(PrinterName), PrinterHandle, nil)
    then raise exception.create(PrinterName+#13+'OpenPrinter error ' + IntToStr(GetLastError));

  with DocInfo1 do
  begin
    pDocName := PChar('Keuken Doc');
    pOutputFile := nil;
    pDataType := 'RAW';
  end;
  if StartDocPrinter(PrinterHandle, 1, @DocInfo1) <> 0  then
  begin
    StartPagePrinter(PrinterHandle) ;
    WritePrinter(PrinterHandle, PAnsiChar(comando), Length(comando), N);
    EndPagePrinter(PrinterHandle);
    EndDocPrinter(PrinterHandle);
    ClosePrinter(PrinterHandle);
    Result := True;
  end;
end;
Responder Con Cita