Printing Bold in javax.print

205 Views Asked by At

I want to print the whole text in bold or change the font size. Is there a way to do this?

private void print(String txt, String printerName) {
    PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
    PrintService service = findPrintService(printerName, printService);

    try {
        DocPrintJob job = service.createPrintJob();

        byte[] bytes;
        bytes = txt.getBytes("UTF-8");

        Doc doc = new SimpleDoc(bytes, flavor, null);

        job.print(doc, null);

        //byte[] cutP = new byte[] { 0x1d, 'V', 1 };
    } catch (Exception e){
        e.printStackTrace();
    }
}
0

There are 0 best solutions below