Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 02-09-2014
Avatar de anubis
anubis anubis is offline
Miembro
 
Registrado: mar 2007
Posts: 863
Poder: 20
anubis Va por buen camino
Gracias por aporte,

Seoane, intente compilarlo en lazarus pero me da error en
Código Delphi [-]
if OpenPrinter(PChar(PrinterName), PrinterHandle, nil) then



Código:
unit1.pas(48,51) Error: Incompatible type for arg no. 2: Got "LongWord", expected "PHANDLE"
unit1.pas(50,21) Hint: Local variable "DocInfo" does not seem to be initialized
unit1.pas(57,37) Warning: Local variable "PrinterHandle" does not seem to be initialized
unit1.pas(73,54) Error: Incompatible type for arg no. 4: Got "LongWord", expected "PDWord"
unit1.pas(90) Fatal: There were 2 errors compiling module, stopping]
Primero lo saque directamente de tu codigo printtest, aunque de momento me interesa el que pusiste aqui.

No se puede compiar en lazarus, aunque le cambie el modo de sintaxis a delphi?

Lo que prentendo solo es imprimir en impresora de tickets y que solo imprima lo que envio y no me saque un feed del tamaño asignado.

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject); 
 var    iImpresora : TextFile; 
 begin    
Assignfile(iImpresora,'LPT1'); //Puerto: LPT1, COM1, etc;    
Rewrite(iImpresora); 
 Writeln(iImpresora,'Esto debe salir por la impresora.');    
CloseFile(iImpresora);  
end;


[font=Arial]Este metodo no me funciona porque no imprime nada.

Código Delphi [-]
with Printer do      
begin        
PRINTER.PrinterIndex:=COMBOBOX1.ItemIndex;       
 r := Rect(200,200,(Pagewidth - 200),(PageHeight - 200));        
BeginDoc;        
Canvas.Brush.Style := bsClear;       
 for i := 0 to IMPRIMIR.Count -1 do        
 Canvas.TextOut(200,200 + (i *                    
 Canvas.TextHeight(IMPRIMIR.Strings[i])),                    
 IMPRIMIR.Strings[i]);        
 Canvas.Brush.Color := clBlack;       
 Canvas.FrameRect(r);       
 EndDoc;


Este si funciona pero me hace feed de papel.

La impresora es una epson tm-u220pa por puerto paralelo.

Tambien he visitado la pagina de epson en relación a los codigos

Código:
PRINT #1 "Hola"; -Imprime texto
PRINT #1 CHR$(&H1B); "d"; CHR$(11); -Avanza 11 líneas 
PRINT #1 CHR$(&H1B); "i"; -Ejecuta corte completo
Pero primero hay que hacer un assignfile que no funciona.

Alguna idea del cómo, ya no se donde mas buscar.


Gracias y perdon por ser tan largo.

Última edición por anubis fecha: 02-09-2014 a las 02:57:57.
Responder Con Cita
  #2  
Antiguo 04-09-2014
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.210
Poder: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Para compilar con Lazarus debes realizas los cambios siguientes:

Código Delphi [-]
uses
  Windows, Printers, Winspool;

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;

Saludos.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
¿Como imprimir sin? superhopi Impresión 3 13-04-2007 04:46:45
¿Cómo imprimir? roman Linux 15 21-03-2007 20:53:36
como imprimir?? mminorm Impresión 6 01-06-2005 08:57:20
Como imprimir......... pampitasnowman Impresión 3 20-08-2003 21:24:16


La franja horaria es GMT +2. Ahora son las 01:26:26.


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