操作系统之间的不同java打印实现?

操作系统之间的不同java打印实现?,java,linux,printing,cups,Java,Linux,Printing,Cups,我正在使用以下代码将原始数据(转义码)发送到打印机: PrintService pservice = this.getPrintService(); DocPrintJob job = pservice.createPrintJob(); DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE; Doc doc = new SimpleDoc(printdata, flavor, null); job.addPrintJobListener(this)

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

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版本的驱动程序),当我发送原始数据时,它只打印一个空页面并报告一个打印错误。 奇怪的是,如果我使用systemlpr命令发送数据,一切都正常工作

关于可能出现的问题有什么线索吗

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

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

[edit2]类似的线程和我不太喜欢的解决方案:

[编辑部3] 在尝试不同的DocFlavor时,我发现了新的错误:

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配置错误?

您使用的是哪个CUPS驱动程序?杯子里有什么吗?我认为驱动程序需要配置为原始打印,否则它将根据mime类型进行转换。我正在使用这里找到的驱动程序:(我有一个Dymo 400)。既然我是linux新手,你能告诉我我们要找日志吗?看看这个,日志应该在/var/log/cupsThanks中。我把日志贴在主柱子上。我读了你的链接;有趣的是,“cat filename | lpr”即使不使用-o raw_选项也能工作。从日志来看,它似乎遇到了问题,Q'中的_Error:/undefined,也许你可以在cups完成打印作业文件后找到它,看看内容是什么,如果它们与你发送的内容不同,cups spool dir是/var/spool/cups,我想,但不记得完成的作业去了哪里