0

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();
    }
}
JHoerbst
  • 918
  • 9
  • 17
  • 1
    You could wrap the text in `...` and use a `text/html` based mime type – MadProgrammer May 23 '17 at 22:58
  • @MadProgrammer thanks for the response, but it won't work! – JHoerbst May 24 '17 at 12:03
  • It "won't" or "didn't"? Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This is not a code dump, but an example of what you are doing which highlights the problem you are having. This will result in less confusion and better responses – MadProgrammer May 24 '17 at 12:22
  • @MadProgrammer didn't, sorry for the confusion – JHoerbst May 24 '17 at 12:42

0 Answers0