0

我想以粗体打印整个文本或更改字体大小。有没有办法做到这一点?

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();
    }
}
4

0 回答 0