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.

problem:
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); pageFormat.setPaper(paper); int i; double x, y; x = pageFormat.getImageableX(); y = pageFormat.getImageableY() + fm.getMaxAscent();   // do the headings	if (header != null) {	graphics.setFont(typeFontBold);	for (i = 0; i < header.length; i++) {	graphics.drawString(header[i], (int) x, (int) y);	y += fm.getHeight();	}	}  	// do the body	if (body != null) {	graphics.setFont(typeFont);	for (i = 0; i < body.length; i++) {	graphics.drawString(body[i], (int) x, (int) y);	y += fm.getHeight();	}	}