到目前为止,我有以下代码:
FileInputStream fin =new FileInputStream(filename);
DocFlavor df = DocFlavor.INPUT_STREAM.AUTOSENSE;
Doc d = new SimpleDoc(fin, df, null);
PrintService P = PrintServiceLookup.lookupDefaultPrintService();
if (P != null) {
DocPrintJob job = P.createPrintJob();
job.print(d, null);
}
fin.close;
代码工作正常,但如果文件包含命令,打印机不会解释命令,它会继续打印文件的确切字符串内容。那么如何向爱普生收据打印机发送命令?