Problem in Printing a text file
Hi all good morning.
I have a problem. I am dynamically creating a text file depending on some creteria and I want to print that text file using java print API. I written the following code.
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
PrintService printService[] = PrintServiceLookup
.lookupPrintServices(flavor, pras);
PrintService defaultService = PrintServiceLookup
.lookupDefaultPrintService();
PrintService service = ServiceUI.printDialog(null, 200, 200,
printService, defaultService, flavor, pras);
if (service != null) {
DocPrintJob job = service.createPrintJob();
FileInputStream fis = new FileInputStream (file.getCanonicalPath());
DocAttributeSet das = new HashDocAttributeSet();
Doc doc = new SimpleDoc(fis, flavor, das);
job.print(doc, pras);
Thread.sleep(10000);
}
It worked fine for HP Printers. But it is not working with xerox printers.
If anybody knows solution please let me know

