我的CUPS支持: [23 / Jul / 2018:16:03:29 +0300] [作业80]支持文档格式(30 值)
当我尝试发送以打印JPG时,JPEG content_type 发送 “应用程序/八位字节流类型的文件由...排队” 而是转换为“ image / jpeg”。
当我尝试发送以打印PDF和PNG content_type 时,请正确发送 分别是“ application / pdf”和“ image / png”。
使用DocPrintJob = UnixPrintJob,PrintService = IPPPrintService的类
当我尝试使用 lpr JPEG文件进行打印时,打印机会正确打印文件
================================================ ===============
PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
printServiceAttributeSet.add(new PrinterName( printQueueName, null ));
PrintService printServices[] = PrintServiceLookup.lookupPrintServices( null,
printServiceAttributeSet );
if ( printServices.length != 1 )
{
Lib.log.warnf( "Print queue with name %s is not found", printQueueName );
throw ValidateException.warn( PrintmanMld.PRINT_QUEUE_IS_NOT_FOUND, printQueueName );
}
DocPrintJob job = printServices[0].createPrintJob();
try
{
if ( contentStream.available() <= 0 )
{
Lib.log.warn("Print file is empty");
throw ValidateException.warn(PrintmanMld.PRINT_FILE_IS_EMPTY);
}
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
Doc doc = new SimpleDoc( contentStream, flavor, null );
job.print( doc, aset );
}
catch( PrintException | IOException ex )
{
Lib.log.error( ex.getLocalizedMessage(), ex );
throw new ExecutionContextException(ex);
}