Recent

Author Topic: Print GroupBox contents  (Read 458 times)

GalZoli

  • Newbie
  • Posts: 2
Print GroupBox contents
« on: February 13, 2025, 04:28:49 pm »
Hello Everyone! Please help me a little. I want to print the contents of a GroupBox on a block printer. A QR code is created at runtime in the GroupBox, with a fixed Image component above and below it. How should it be?
Thank you very much!

dseligo

  • Hero Member
  • *****
  • Posts: 1480
Re: Print GroupBox contents
« Reply #1 on: February 13, 2025, 10:32:34 pm »
Hello Everyone! Please help me a little. I want to print the contents of a GroupBox on a block printer. A QR code is created at runtime in the GroupBox, with a fixed Image component above and below it. How should it be?
Thank you very much!

What is block printer?
OS?
FPC? Lazarus?

GalZoli

  • Newbie
  • Posts: 2
Re: Print GroupBox contents
« Reply #2 on: February 14, 2025, 09:09:51 am »
Okay, in the meantime it was almost solved, the only thing that needs to be done is to be able to select the printer from the menu and the paper size from the program. If you could remember these settings, that would be even better. Anyway, sorry, I missed the question: Lazarus and Windows 10 64bit, Block printer: https://onlinepenztargepek.hu/blokk-nyomtatok/epson-tm-t20-blokk-es-szamlanyomtato-detail

Here I am so far:
Code: Pascal  [Select][+][-]
  1. procedure TDemoAPI.printClick(Sender: TObject);
  2. var
  3.   MyPrinter : TPrinter;
  4.   myBitMap : TBitMap;
  5.  
  6. begin
  7.  
  8.   myBitMap := TBitMap.Create;
  9.   myBitMap.Width := page.Width;
  10.   myBitMap.Height := page.Height;
  11.   page.BorderStyle:=bsNone;
  12.   page.PaintTo(myBitMap.Canvas, 0, 0);
  13.   page.BorderStyle:=bsSingle;
  14.   //
  15.   MyPrinter := Printer;
  16.   MyPrinter.BeginDoc;
  17.     //page.PaintTo(myPrinter.Canvas, 0, 0);
  18.     //myPrinter.Canvas.Draw(0,0, myBitMap);
  19.  
  20.    // myPrinter.PaperSize.Width := edit1.text;   //NOT WORKING!!!
  21.  
  22.     myPrinter.Canvas.CopyRect(Classes.Rect(0, 0, myPrinter.PaperSize.Width, myPrinter.PaperSize.Height),
  23.        myBitMap.Canvas, Classes.Rect(0, 0, myBitMap.Width, myBitMap.Height));
  24.   MyPrinter.EndDoc;
  25.   myBitMap.Free;
  26. end;

« Last Edit: February 14, 2025, 09:16:18 am by GalZoli »

 

TinyPortal © 2005-2018