java - Printing works on Linux but not on Windows -
i developing web application prints pdf file (from bytearrayoutputstream).
here code:
printservice service = null; (string printer : listprinters){ for( printservice printservice : printservices ) { attribute[] attrs = printservice.getattributes().toarray(); (int j=0; j<attrs.length; j++) { string attrname = attrs[j].getname(); string attrvalue = attrs[j].tostring(); if (attrname.equals("printer-name")){ if (attrvalue.equals(printer)){ service = printservice; } } } } } try { inputstream fi = new bytearrayinputstream(baos.tobytearray()); docflavor flavor = docflavor.input_stream.autosense; docprintjob printjob = service.createprintjob(); doc doc = new simpledoc(fi, flavor, null); printjob.print(doc, null); } catch (exception e1) { log.debug(e1.getmessage()); }
if deploy war in tomcat 7 on linux server, document printed on printer.
if deploy war in tomcat 7 on windows, can see document on jobs queue of printer, disappears if printing finished, nothing comes out of printer.
don't understand why. using jre 1.8.0_74 on both systems.
developing under linux
if can me on this...
thank you.
[update]
same error when printing simple txt file :
fileinputstream fis = new fileinputstream("c:/mytxt.txt"); doc pdfdoc = new simpledoc(fis, docflavor.input_stream.autosense, null); docprintjob printjob = service.createprintjob(); printjob.print(pdfdoc, new hashprintrequestattributeset()); fis.close();
Comments
Post a Comment