How to format font and text size on a thermal printer using Java

Asked

Viewed 1,437 times

0

Well, I am developing a program for a pizzeria and I need to print the orders with the respective pizza flavors, but with correct formatting, larger letters and such, the pattern is too small for my needs, follows the code I am using

import java.io.FileOutputStream;
import java.io.PrintStream;

public class Impressao {
    public static void main(String[] args) {
        FileOutputStream fos = null;
        PrintStream ps = null;
        try{ 
            fos = new FileOutputStream("LPT1:");
        } catch (Exception ex) {}
        try {
            ps = new PrintStream(fos);
        } 
        catch (Exception exception) {} 

        ps.print("Coloque aqui o que você quer");
    }
}

1 answer

1

You need to read the printer documentation, to change the formatting and other similar in general, there are codes that should be sent to the printer. These codes can vary between the most different printers.

  • I sent a code that would increase the font size but nothing happened

  • I believe you need to send these codes as hexadecimal, check if this happens.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.