Welcome, Guest
Username: Password: Remember me

Print image thermal printer

Posts 1 to 3 of 3
1 week 10 hours ago #7246
Dear Friends
I want your help. I try to print a small image (bmp) in a thermal printer but no luck. I get an empty page. My code is this:

int MaxWidth,MaxHeight;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,Image1->Canvas,ImageSize);TPrinter *PagePrinter = Printer();//PagePrinter->Orientation = poLandscape;PagePrinter->BeginDoc();PagePrinter->Canvas->CopyMode = cmSrcCopy;Scratch->Monochrome=true;PagePrinter->Canvas->StretchDraw(ImageSize, Scratch);PagePrinter->Canvas->TextOut(100, 200,Edit1->Text);PagePrinter->EndDoc();

So i am able to print the text from edit box but i cant print my bmp picture wich i load on TImage(Image1 Component. I want your help because i am not sure what is the problem. My printer is Atec thermal printer that is connected with lan cable on my local network. Is any other method or way to print an image? Or use another component?
Log in to reply.
  • Roger Cigol
  • Roger Cigol's Avatar
  • OFFLINE
  • Gold User
  • Rank: 33
  • Points: 85
  • Thanks 12
5 days 16 hours ago #7261
Hi Thomas,
Your code doesn't actually initialise the values MaxWidth and MaxHeight. Did you cut/paste this code from what you are actually trying? if so add MaxWidth = 200; MaxHeight = 200; and try again.
Are you running on Windows? If so does the printer print the "windows test page" correctly (open up the printer in the control panel and right click and navigate to the "print test page" option).
Regards, Roger.
Log in to reply.
4 days 20 hours ago #7267
Dear friend
I think i have tried that you say byt i will try again. My thermal printer is set up on windows 10 and i print test page and everything is ok. Also if you see at code as test i use and edit box with a simple text inside and everything again is ok and my text is printed. Finally my problem is that i cant print an image from TImage component. Maybe is what you say with width and with height i will try again and let you know. The picture i try to print is bmp.
Log in to reply.
Moderators: Carlos Perez