For reference, we are using Delphi 7 for this project.
I need help with printing graphics to a 9 pin POS printer. Actually I am looking for a universal function to read in a bitmap from a file and return a stream of data in
) format so we can use it with all of our 9 pin POS printers.
The only info I could find on the net about APA graphics format was in an old ESC/P
manual. APA format is a vertical slice of bitmap data printed as the head moves
across the paper which is much different than the way the bitmap data is stored
in a .bmp file. All of the bitmaps we will be sending to the printer are 1 bit black and white. We also need the function to scale the bitmap using x0, y0, x1, y1 arguments.
My current test printer is a Cognitive TPG-A760.
Programming Doc can be found here...
A760 Programmers Manual
If I can get it working with the A760, I can
get it working on our others.
The A760 programmers manual has a command:
ESC (+*.BMP file)
but we can't use this since its not offered in our other printers.
We prefer to use Command:
ESC * m n1 n2 d1...dn
Where m = 0
and n1 + (256 * n2) bytes of data
Here is my function so far:
function BMPtoAPA(bmp:TBitmap; x0, y0, x1, y1:Integer ): String;
byteArray: array of array of byte;
result := '';
if Not Assigned(bmp) then exit;
SetLength(byteArray, bmp.Height, bmp.Width);
for iRow := 0 to bmp.Height-1 do
Row := bmp.Scanline[iRow];
for iCol := 0 to bmp.Width - 1 do
byteArray[iRow,iCol] := Row[iCol];
byteArray := nil;