为什么不接受我的打印任务啊?
程序如下,Jdk1.5
-------------------------------------
System.out.println("---------| Begin to Print ......");
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
/* locate a print service that can handle it */
PrintService pservices[] = PrintServiceLookup.lookupPrintServices(flavor,aset);
/* create a print job for the chosen service */
DocPrintJob pj = pservices[0].createPrintJob();
try {
FileInputStream fis = new FileInputStream("d:/test.txt");
Doc doc = new SimpleDoc(fis, flavor,null);
/* print the doc as specified */
try {
pj.print(doc,aset);
}
catch (PrintException e) {
e.printStackTrace();
}
}
catch (IOException ie) {
System.err.println(ie);
}
----------------------------------
输出结果:
javax.print.PrintException: Printer is not accepting job.
at sun.print.Win32PrintJob.print(Unknown Source)