How to print any texts or receipt to Thermal Printer on Thermal Paper

Here I’m using text variable mentioned below to print text to Thermal Printer on Thermal Paper.

String text= “Welcome to My Website\n This is a test Print”;

mmOutputStream.write(INIT);

mmOutputStream.write(SELECT_FONT_B);

mmOutputStream.write(SET_EMPHASIZED_MODE_ON);

mmOutputStream.write(text.getBytes());

Now for underline the text, these following commands should be used

mmOutputStream.write(INIT);

mmOutputStream.write(SELECT_FONT_B);

mmOutputStream.write(SET_EMPHASIZED_MODE_ON);

mmOutputStream.write(SET_UNDERLINE_MODE_ON_1DOT_WIDTH);

mmOutputStream.write(text.getBytes());

For Line Spacing you can also use these following commands

public static byte[] SET_LINE_SPACING_24 = {0x1B, 0x33, 24};

public static byte[] SET_LINE_SPACING_30 = {0x1B, 0x33, 30};

mmOutputStream.write(SET_LINE_SPACING_24);

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart