I am working on a web application that will be used as a cashier the only thing left I need to do is to print a receipt for the customer using a
thermal printer.

The words I print on the paper does not entirely print for example i try to print "hello world" when I trya to print
the ouput is "Hello wor" even if theres still space left in the paper to print on

my code:

Paper paper = new Paper();
paper.setSize(150, 100);
int i;
double x, y;
x = pageFormat.getImageableX();
y = pageFormat.getImageableY() + fm.getMaxAscent();
// do the headings
		if (header != null) {
			for (i = 0; i < header.length; i++) {
				graphics.drawString(header[i], (int) x, (int) y);
				y += fm.getHeight();
		// do the body
		if (body != null) {
			for (i = 0; i < body.length; i++) {
				graphics.drawString(body[i], (int) x, (int) y);
				y += fm.getHeight();