Printing a postscript file
Hi there,
I wonder if I'm missing something simple here...
I have this code, which quite happily prints postscript files to the designated printer, however it always prints duplex.
As you can see, I have added print request attributes to force single-sided and two copies, but both of these attributes are ignored.
PrintService defaultService = getDefaultPrintService();
if (defaultService !=null){
try{
DocPrintJob docPrintJob = defaultService.createPrintJob();
FileInputStream fileInputStream =new FileInputStream(printFile);
Doc doc =new SimpleDoc(fileInputStream, DocFlavor.INPUT_STREAM.POSTSCRIPT,null);
HashPrintRequestAttributeSet attribs =new HashPrintRequestAttributeSet();
attribs.add(Sides.ONE_SIDED);// <====
attribs.add(new Copies(2));// <====
docPrintJob.print(doc, attribs);
}catch (Exception e){
ExceptionHelper.logException(CLASS,"Print Failure", e);
thrownew DSEException(DSEException.critical,"","Input file name : " + outputFileName);
}finally{
// clean up - now delete the postscript file
printFile.delete();
}
}else{
thrownew DSEException(DSEException.critical,"","Default Printer Has Not Been Set Up: ");
}
I realise you cannot actually run this code, but it is a bit difficult to provide a working example, unless you have a postscript file hanging around (maybe that's simple?) but can anyone spot an obvious mistake in the code I've shown?
Thanks,
Tim

