问题
hi guys i have the next problem i can't print my bit image without white line each 24 lines. ie i need to print a image but this image have white lines each 24 lines to bits.
the epson printer print the image to the next format.
>line 23 01010101000010001010
>line 24 00001000100000000110
>line 25 --------- white line ------------
how can delete this damn white line?
Image size
width:400px
height:73px
while (offset < height)
{
//format ESC* Epson printer
String modIMG = new String(new byte[]{0x1B, 0x2A, 33, 0, 2});
img.append(modIMG);
for (int x = 0; x < width; ++x) {
for (int k = 0; k < 3; ++k) {
byte slice= 0;
for (int b = 0; b < 8; ++b) {
int y = (((offset / 8) + k) * 8) + b;
int i = (y * width) + x;
boolean v = false;
if (i < bitSet.length()) {
v = bitSet.get(i);}
slice |= (byte) ((v ? 1 : 0) << (7 - b));
}
img.slice(new String(new byte[] {slice}));
}
}
offset += 24;
img.append(new String(new String(new byte[]{0x1B,0x33,30}));
}
thanks and advance!
回答1:
So I solved this problem. It is not enough to set the line spacing to 24 dots using ESC '3' 24, but you have to print the image in page mode.
To enter page mode: ESC 'L'
Then you have to set the image area using ESC 'W', here I do it in C:
h2 = h * 2 + 30;
/* Set the printing area, h * 2 because of double density */
seq[0] = 0x1b;
seq[1] = 'W';
seq[2] = 0; /* xl */
seq[3] = 0; /* xh */
seq[4] = 0; /* yl */
seq[5] = 0; /* yh */
seq[6] = 0; /* dxl */
seq[7] = 2; /* dxh */
seq[8] = h2 % 256; /* dyl */
seq[9] = h2 / 256; /* dyh */
if (write(fd, seq, 10) != 10)
goto finish;
Now send the image data and finally print with sending 0x0c, this also returns the printer to standard mode.
By using page mode, the white stripes on the image went away.
BTW, this seems to be an oddity of EPSON TM-T88 printers, I neither see these white lines on the TM-T500A nor on e.g. Aures printers. On these printers I can use standard mode to print images.
回答2:
I solved it setting page mode followin Marc Balmer's example, but have to send feed for 24*2 dots (line height double density) to get it working: So after every slice of data send command ESC J n
bytes {27, 74, 48}
. And finally got it!
Hope it helps!
Reference (must be logged)
回答3:
Try sending ESC/POS command (0x1B, '3', 24) prior to printing. This sets the line spacing to 24 dots rather than the default of 30.
回答4:
Just to confirm what other people have suggested, I've successfully managed to remove the white lines between the data stripes using "ESC30". You can see the actual code (Haskell) and the results here.
来源:https://stackoverflow.com/questions/21192888/how-print-bit-image-tm-t88v