Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing logo\image to com port printer 1

Status
Not open for further replies.

earlrainer

Programmer
Mar 1, 2002
170
IN
Hi,

I have a receipt printer connected to a com port on my machine.
is there any way to print a logo (any image) on the printer.
I can change the fonts on the printer by sending different control sequence to printer.But I havent managed to print a
logo .
is there any way to do so
 
There are several answers to this question.
If you are using a receipt printer that comes with a windows driver, you can just use the printer's canvas, drawing on it with the various tcanvas methods.
Since your question specified that it is a com port based printer and that you use control codes, I have to assume that either you are not using the printer's driver for your existing printing or that no driver exists.
In this case, you will need to get the programmers specification for the model of printer you are using. I use epson thermal receipt printers with my software and they offer control codes to put the printer in graphics mode. I then take a bitmap image (which I have previously saved in uncondensed 1-bit deep format) and (reading it like a file of 1 byte records) feed it into the com port. After all of the bytes have been sent, I send a different control code to get the printer out of graphics mode and then I continue printing.
The results are pretty impressive, but the code is very printer/model specific. Using a printer driver and the printer's canvas is a far more generic solution.
Peace,
Colt.
 
Hi Colt,
you are right.I am not using the drivers.
I am also using Epson thermal printers.
can you tell how you save your images in that format and then send it to the comport.
and how do you put it in graphics mode.

thanks.
 
Sorry for not responding sooner! I was away on holiday.
If you load your graphic into Windows Paint and then select Save-As from the file menu, one of the formats which you can select is "Monochrome bitmap" which is a 1-bit deep uncompressed bitmap.
There are a few tricks to working with monochrome bitmaps...
1). Skip the first 62 bytes (decimal) since they are header information which you shouldn't need. You may want the height and width values which are longint's at offsets 18 and 22 (decimal) respectively, but other than that there's not a lot of useful info in the header.
2). Set your bitmap width so that each horizontal set of 1-bit pixels will fit in a number of bytes that is evenly divisible by 4. (example 300 pixels with 8 pixels per byte means 37.5 bytes which won't work. uses a width of 288 pixels instead.) If the horizontal lines are not evenly divisible into 4 byte structures, Windows adds blank pixels to the end of each line to make it come out evenly. This can make dumping the pixels to the printer more difficult so an easy solution is just to require that images be a set number of pixels wide. Thats what I do.
By the way, you are obviously writing a POS (and by the nature of your questions, a fairly feature rich POS). What market are you tragetting? Don't feel obliged to answer if you've discovered a virgin niche market. I'm just hoping you won't be competing with me in the Golf Course market.
Peace,
Colt@computergolf.com
 
Thanks Colt,

I will soon be trying your method and will be back with more queries.

Thanks once again.

I am further developing an existing POS system used by a chain of shops selling shoes and related accessories.

Bye :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top