我试图用Java在Argox OS-214 Plus(USB)中打印一些数据。它会正确打印文本,但不带重音字母(包括ç)。
我认为将数据发送到打印机时可能是编码问题。
我尝试了很多编码工作,但没有任何帮助。
PrintService printService = PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob job = printService.createPrintJob();
// normal text being printed, with the accents normals.
System.out.println(text);
InputStream is = new ByteArrayInputStream(text.getBytes("UTF-8"));
/*
// other tentative without success
InputStream is = new ByteArrayInputStream(new String(text.getBytes("UTF-8"), "UFT-8"));
*/
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
Doc doc = new SimpleDoc(is, flavor, null);
job.print(doc, null);
is.close();