Ir al contenido


Foto

Imprimir memo en Impresora


  • Por favor identifícate para responder
4 respuestas en este tema

#1 el-mono

el-mono

    Advanced Member

  • Miembros
  • PipPipPip
  • 148 mensajes

Escrito 29 junio 2017 - 07:11

Hola.

Necesito imprimir un pequeño ticket con Firemonkey sobre impresora por defecto en Windows.

No quiero usar ningún reporteador solo imprimir unas lineas de texto que voy a escribir sobre un Memo hacia la impresora determinada en Windows.

 

Alguien pudo o sabe como hacerlo ?

 

 

 

 

 


  • 0

#2 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14.446 mensajes
  • LocationMéxico

Escrito 29 junio 2017 - 08:25

Hola.
Necesito imprimir un pequeño ticket con Firemonkey sobre impresora por defecto en Windows.
No quiero usar ningún reporteador solo imprimir unas lineas de texto que voy a escribir sobre un Memo hacia la impresora determinada en Windows.
 
Alguien pudo o sabe como hacerlo ?

 
Hola
 
Utiliza TPrinter.Canvas.
  


delphi
  1. Printer.BeginDoc;
  2. Printer.Canvas.TextOut(0,0,'Aquí el Texto');
  3. Printer.EndDoc;

Edito: La unidad FMX.Printer ya no tiene la propiedad TextOut, investigaré cual es la correspondencia.
 
Pero podrías intentar mientras con:

 


delphi
  1. var
  2. prn: TextFile;
  3. begin
  4. AssignPrn(prn);
  5. Rewrite(Prn);
  6. Writeln(prn, 'texto a imprimir');
  7. CloseFile(prn);
  8. end;

Saludos


  • 0

#3 el-mono

el-mono

    Advanced Member

  • Miembros
  • PipPipPip
  • 148 mensajes

Escrito 30 junio 2017 - 06:08

Gracias egostar. Estoy probando con este codigo pero el texto sale muy pequeño y no puedo darle formato.


delphi
  1. var
  2. MyRect: TRectF;
  3. begin
  4. // Image1.Bitmap.Clear($FFFFFF);
  5. // sets the rectangle where the text will be displayed
  6. MyRect := TRectF.Create(0, 0, 400, 570);
  7. // fills and draws the text in the specified rectangle area of the canvas
  8.  
  9. Printer.BeginDoc;
  10. Printer.Canvas.Font.Style := [];
  11. Printer.Canvas.Font.Size := 12;
  12. Printer.Canvas.FillText(MyRect, 'Texto a Imprimir', false, 1,[], TTextAlign.Center, TTextAlign.Center);
  13. Printer.EndDoc;


  • 0

#4 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14.446 mensajes
  • LocationMéxico

Escrito 30 junio 2017 - 09:35

 

Gracias egostar. Estoy probando con este codigo pero el texto sale muy pequeño y no puedo darle formato.


delphi
  1. var
  2. MyRect: TRectF;
  3. begin
  4. // Image1.Bitmap.Clear($FFFFFF);
  5. // sets the rectangle where the text will be displayed
  6. MyRect := TRectF.Create(0, 0, 400, 570);
  7. // fills and draws the text in the specified rectangle area of the canvas
  8.  
  9. Printer.BeginDoc;
  10. Printer.Canvas.Font.Style := [];
  11. Printer.Canvas.Font.Size := 12;
  12. Printer.Canvas.FillText(MyRect, 'Texto a Imprimir', false, 1,[], TTextAlign.Center, TTextAlign.Center);
  13. Printer.EndDoc;

 

 

En efecto, sale muy pequeña la letra, he estado jugando con algunas propiedades con efectos raros :D :D :D ya te diré si logro encontrar como ajustar la letra. (y)

 

Saludos


  • 0

#5 genriquez

genriquez

    Advanced Member

  • Miembro Platino
  • PipPipPip
  • 539 mensajes
  • LocationCali, Colombia

Escrito 02 julio 2017 - 11:31

Hola, en FireMonkey es necesario especificar que propiedades toma del estilo y cuales modificarás manualmente, de lo contrario siempre toma el estilo seleccionado.

 

Ejemplo, si se desea cambiar dinámicamente una propiedad de un label, se debe "Restar" el parámetro correspondiente.

 


php
  1.    Label1.StyledSettings :=  [TStyledSetting.Family, TStyledSetting.Size, TStyledSetting.Style, TStyledSetting.FontColor, TStyledSetting.Other];  //así se asignarían todos las propiedades (Por defecto)
  2.  
  3.  
  4.    Label1.StyledSettings :=  Label1.StyledSettings - [TStyledSetting.Size]; //Así se le dice que se quiere cambiar dinámicamente el tamaño de la letra

Espero te sea de utilidad

 

 

Saludos.


  • 2




IP.Board spam blocked by CleanTalk.