Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

 
 
Herramientas Buscar en Tema Desplegado
  #5  
Antiguo 01-09-2008
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Poder: 26
seoane Va por buen camino
Pues ya es lunes, y he probado el código con una impresora de tickets (Toshiba A10) y va de maravilla. Solo me falta saber como puedo hacer para imprimir el logo, o por lo menos saber como mandar las secuencias de escape para imprimirlo yo mismo.

El código es el siguiente (el formulario son un edit, tres botones, un memo y un componente TOPOSPOSPRinter).

Código Delphi [-]
unit ufrmMain;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtrls, OposPOSPrinter_CCO_TLB, StdCtrls;
type
  TfrmMain = class(TForm)
    OPOSPrinter: TOPOSPOSPrinter;
    btnOpen: TButton;
    txtLog: TMemo;
    btnClose: TButton;
    btnPrint: TButton;
    txtPrinter: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure OPOSPrinterStatusUpdateEvent(ASender: TObject; Data: Integer);
    procedure btnOpenClick(Sender: TObject);
    procedure btnCloseClick(Sender: TObject);
    procedure btnPrintClick(Sender: TObject);
    procedure OPOSPrinterOutputCompleteEvent(ASender: TObject;
      OutputID: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  frmMain: TfrmMain;
implementation
{$R *.dfm}
uses OPOSConst;
procedure TfrmMain.btnCloseClick(Sender: TObject);
var
  nRC: Integer;
begin
  txtLog.Lines.Add('+Close');
 OPOSPrinter.Close(nRC);
 txtLog.Lines.Add('  Close: RC = ' + IntToStr(nRC));
  if nRC = OPOS_SUCCESS  then
   txtLog.Lines.Add('-Close: Succeeded')
  else
    txtLog.Lines.Add('-Close: Failed');
end;
 
procedure TfrmMain.btnOpenClick(Sender: TObject);
var
  nRC: Integer;
begin
  if txtPrinter.Text <> EmptyStr then
  begin
    txtLog.Lines.Add('+Open: DeviceName = ' + txtPrinter.Text);
    // Open the printer
    OPOSPrinter.Open(txtPrinter.Text,nRC);
    txtLog.Lines.Add('  Open: RC = ' + IntToStr(nRC));
    // If succeeded, then claim.
    if nRC = OPOS_SUCCESS  then
    begin
      OPOSPrinter.ClaimDevice(1000,nRC);
      txtLog.Lines.Add('  Claim: RC = ' + IntToStr(nRC));
      // If succeeded, then enable.
      if nRC = OPOS_SUCCESS then
      begin
        nrc:= OPOSPRinter.DefaultInterface.Set_DeviceEnabled(TRUE);
        txtLog.Lines.Add('  Enable: RC = ' + IntToStr(nRC));
      end;
      txtLog.Lines.Add('-Open: Succeeded');
    end else
      txtLog.Lines.Add('-Open: Failed');
  end;
end;
procedure TfrmMain.btnPrintClick(Sender: TObject);
var
  nRC: Integer;
begin
  txtLog.Lines.Add('+Print');
 OPOSPrinter.PrintNormal(PTR_S_RECEIPT, WideString('Hola mundo')+#0013#0010,nRC);
 txtLog.Lines.Add('  Print: RC = ' + IntToStr(nRC));
 if nRC = OPOS_SUCCESS  then
   txtLog.Lines.Add('-Print: Succeeded')
  else
    txtLog.Lines.Add('-Print: Failed');
end;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
  //
end;
procedure TfrmMain.OPOSPrinterOutputCompleteEvent(ASender: TObject;
  OutputID: Integer);
begin
  txtLog.Lines.Add('  OutputComplete: ' + IntToStr(OutputID));
end;
procedure TfrmMain.OPOSPrinterStatusUpdateEvent(ASender: TObject;
  Data: Integer);
begin
  txtLog.Lines.Add('  StatusUpdate: ' + IntToStr(Data));
end;
end.
Responder Con Cita
 


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
Imprimir usando distintas impresoras luxus Impresión 3 03-04-2008 14:00:49
Imprimir usando un DBLookupComboBox esimon Impresión 0 05-10-2007 20:39:19
Drivers OPOS???? tarco35 Impresión 2 19-01-2007 20:58:24
¿Como Imprimir Rápido en QReport usando Impresoras Matriciales? AGAG4 Impresión 13 19-08-2006 03:32:08
Como imprimir imagen usando la ruta de esta AndGaG Impresión 3 11-07-2006 22:14:25


La franja horaria es GMT +2. Ahora son las 21:18:23.


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