Question

I need to print a few lines to a receipt printer (Star TSP100). I can write the text to a file and use this line to print:

Desktop.getDesktop().print(new File("test.txt"));

The problem is that the text size when I do this is very tiny. Since the file is plain text, I don't know how to adjust the size.

What's the easiest way to make this text readable?

Was it helpful?

Solution 2

Sending lpr commands directly to the printer results in a reasonable text size. This solution works for my situation.

OTHER TIPS

Just change your TXT file to an RTF (Rich Text Format) file! java.io.File can read a lot of different types!

But... if you want to have full control over what you print, draw everything to a Graphics2D object, then print that. There's a nice tutorial on how to do that here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top