0

我正在使用以下代码将 RAW 数据(转义码)发送到打印机:

PrintService pservice = this.getPrintService();
DocPrintJob job = pservice.createPrintJob();
DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
Doc doc = new SimpleDoc(printdata, flavor, null);
job.addPrintJobListener(this);
    try {
        job.print(doc, null);
...

这在 Windows 中正常工作,打印机解释转义码并按我的预期打印。

在 Linux 中(我安装了驱动程序的 CUPS 版本),当我发送原始数据时,它只是打印一个空白页面并报告打印错误。奇怪的是,如果我使用系统lpr命令发送数据,一切正常。

关于可能出错的任何线索?

[注意]随意编辑我的标题,我想不出更好的

[编辑] 这是我得到的错误日志:LOGS

[edit2]我不太喜欢的解决方案的类似线程:Java 中的 Linux 打印

[edit3] 尝试不同的 DocFlavors 我想出了新的错误:

E [07/Dec/2012:17:45:44 +0100] Unknown directive SystemGroup on line 4 of /etc/cups/cupsd.conf.
E [07/Dec/2012:17:45:44 +0100] Unknown directive JobPrivateAccess on line 85 of /etc/cups/cupsd.conf.
E [07/Dec/2012:17:45:44 +0100] Unknown directive JobPrivateValues on line 86 of /etc/cups/cupsd.conf.
E [07/Dec/2012:17:45:44 +0100] Unknown directive SubscriptionPrivateAccess on line 87 of /etc/cups/cupsd.conf.
E [07/Dec/2012:17:45:44 +0100] Unknown directive SubscriptionPrivateValues on line 88 of /etc/cups/cupsd.conf.
W [07/Dec/2012:17:45:44 +0100] CreateProfile failed: org.freedesktop.ColorManager.AlreadyExists:profile id 'LabelWriter-400-Gray..' already exists
W [07/Dec/2012:17:45:44 +0100] CreateDevice failed: org.freedesktop.ColorManager.AlreadyExists:device id 'cups-LabelWriter-400' already exists

这可能指向 CUPS 配置错误吗?

4

0 回答 0