Welcome, Guest
Username: Password: Remember me

Print in thermal Printer, Reports

Posts 1 to 5 of 5
3 months 1 week ago #6662
Dear Friends
I want to ask you a simple question. I have a small database and a simple interface in C++Builder XE8. I want to ask 2 things. First of all how i can take some reports from database, can i use somehow crystal reports tool is anyother that i can use? My second question is how i can print some data in thermal printer. Is any componnent? I guess i need some code too. For example if i have some editboxes with data and i want to print it thermal printer with dimensions 80x80 paper how i have to start
Log in to reply.
  • Roger Cigol
  • Roger Cigol's Avatar
  • OFFLINE
  • Gold User
  • Rank: 33
  • Points: 85
  • Thanks 16
2 months 1 week ago #6937
Hi Thomas,
This is two discussions in one - not helpful for other forum users.
I suggest leave this one as "thermal printer" - and repost a second one regarding report options (although I fear the number of approaches here is large and you will need to more accurately specify the nature of the reports you are trying to generate in order to get anyone to be able to offer useful advice).
Q: How is your thermal printer connected to the PC (hardware) ?
Q: How is your thermal printer connected to the PC software wise? does it have Windows drivers (and therefore appears as a standard windows printer?) or is it a simple Ascii device that you send ascii characters directly to?
(Some devices can be installed either with or without drivers, in which case let us know which option you have gone for).
If it is driven by a Windows driver then can you print successfully to it from, say, notepad (or a word processor?).
It's always helpful to list the compiler version, operating system and (in your case) thermal printer manufacturer and type number when posting questions...
Regards, Roger
Log in to reply.
2 months 1 week ago #6976
Dear Friend
As far for the printing in thermal printer i did some progress with a very simple code like that:

TPrinter *Printer1 = Printer();
Printer1->BeginDoc();
Printer1->Canvas->CopyMode = cmSrcCopy;
Printer1->Canvas->TextOut(100, 200,Edit1->Text);
Printer1->EndDoc();
I print and everything is ok. Now my problem is how to print a logo in top of thermal paper. My thermal printer is atec fastprint and is connected with lan cable. Also my windows are win7 professional.
I still need some help on create reports from database and print them from my application in A4 printer. For example crystal reports maybe?
Log in to reply.
  • Roger Cigol
  • Roger Cigol's Avatar
  • OFFLINE
  • Gold User
  • Rank: 33
  • Points: 85
  • Thanks 16
2 months 6 days ago #7021
Hi Thomas,
All you need to do is to use any of the canvas methods that correspond to TextOut() but that are for graphics.
Here's an example that will copy a rectangle from the client canvas to the default printer.
// here to print out a copy of what is on a section of the client canvas
// (starting in corner (0,0))
// MaxWidth and MaxHeight are values defined elsewhere to suit the size of the
// rectangle we want to print out
Graphics::TBitmap *Scratch = new Graphics::TBitmap;
TRect ImageSize(0, 0, MaxWidth - 1, MaxHeight - 1);
Scratch->Width = MaxWidth;
Scratch->Height = MaxHeight;
Scratch->Canvas->CopyMode = cmSrcCopy;
Scratch->Canvas->CopyRect(ImageSize, ClientImage->Canvas, ImageSize);
// print it out assumes it will fit on one page
TPrinter *PagePrinter = Printer();
PagePrinter->Orientation = poLandscape;
PagePrinter->BeginDoc();
PagePrinter->Canvas->CopyMode = cmSrcCopy;
PagePrinter->Canvas->StretchDraw(ImageSize, Scratch);
PagePrinter->EndDoc();

Regards, Roger
Log in to reply.
1 month 5 days ago #7237
Dear friend
I try to understand somethings but i cant. For example in this line
Scratch->Canvas->CopyRect(ImageSize, ClientImage->Canvas, ImageSize);
I guess imagesize is a variable that we create for size. I dont understand where i will put or load my picture to print it on thermal printer
i get this error
[bcc32 Warning] W8123 Path 'C:\Program Files (x86)\Raize\CS5\Lib\RS-XE8\Win32' not found - path ignored in option '-I'
"[bcc32 Error] Unit2.cpp(42): E2451 Undefined symbol 'ClientImage'
Do i need another component like TImage so i can load a picture there? Or i need to show on my code a path like c:\image.jpg so i can load my picture
Log in to reply.
Moderators: Carlos Perez