Hey again Sera,
So I must be honest haven't really had experience with dev for printers... But I have looked into it a bit and hopefully I can help a little.... It looks like your values for setting the "absolute print position" is incorrect... Value for nL and nH don't make sense according to a function I came across when trying to learn more about the topic. It looks like if values nL and nH are the same, they basically cancel each other out. Here is the function that I trust will come in handy:
private static final float CM_PER_INCH = 2.54f;
public void setAbsoluteHorizontalPosition(float centimeters) {
//pre: centimenters >= 0 (cm)
//post: sets absolute horizontal print position to x centimeters from left margin
float inches = centimeters / CM_PER_INCH;
int units_low = (int) (inches * 60) % 256;
int units_high = (int) (inches * 60) / 256;
pstream.print(ESC);
pstream.print($);
pstream.print((char) units_low);
pstream.print((char) units_high);
}
So in your case you would like to set the position 2 inches from the left margin, using the function above should result in the same thing... But to adapt for the code you have written this section should look like this when setting absolute position:
out.write(27); // esc
out.write(36); // $
out.write(120); // move 2 inches
out.write(0); // This is the value that needed to change
That's about it, give it a try and let me know if it works... Unfortunately I have no way of testing this, also it looks like its working fine for you but just to make sure send a return sequence before flushing (If it results in error, just remove it)
out.write("\n\r");
out.flush();
I really hope I helped a litte bit, here is a refrence to where I got that function from. Maybe you can find other functions that might prove useful to you or use the whole class all together:
http://code.google.c...rinter.java?r=2Here's another useful reference:
http://webpages.char...inks/esc_p2.htmPeace Out