In most POS printers when operating in text mode there is a sequence of characters by which paper is cut
These characters usually vary by brand and model but are usually in the technical manual of the printer.
Simply sending the correct combination of characters is enough
for example
w = new FileWriter(fichero);
bw = new BufferedWriter(fw);
StringBuilder builder = new StringBuilder();
// Message
builder.append("MOTEL OASIS\r\n");
builder.append("AV ESPINOZA 267, COL OBRERA\r\n");
builder.append("ENSENADA, B.C.\r\n");
builder.append("\r\n");
builder.append("DIA EXTRA\r\n);
builder.append("Fecha : ").append(fecha).append(" Hora: ").append(hora).append("\r\n");
builder.append(cantidad).append(" ").append(producto).append(" $").append(total).append("\r\n");
builder.append("\r\n");
builder.append("GRACIAS POR SU PREFERENCIA");
builder.append("\r\n");
// Paper Cut
char[] cutPaper = new char[] { 0x1d, 'i'};
builder.append(cutPaper);
bw.write(builder.toString());
bw.close();
In this case I send the escape character 27 (I have set it so that it is easy to see) and then the character "i"
This example corresponds to the Bematec LR2000 printers
link
For an EPSON T20 or similar (All Epson TM) for example you should change the cutting commands by:
byte[] cutPaper = new byte[] { 0x1d, 'V', 1 };
In short, you should look at the manuals of compatible printers.
Normally there is a set of commands for the different types of printers that allow these operations to be carried out.
The ideal would be to have a class that implements the printer model to use it with the necessary commands.
Also indicate that these commands can allow you to give more life to the text and other functions. There are fast-forward commands (eg move the paper 10 or 100 lines before cutting), center the text, align to the right, ...
Once you have the implementing class you can always send the text block with the cut order twice to have two copies.
Or if you stop the methods call a function print (text) and then cut () twice.