用JAVA编写打印图片程序,调试的时候出现说“RPC 服务器不可用”,下面是具体的情况:(多谢各位帮忙)
这是程序:
public class Main {
static public void main(String args[]) throws Exception {
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new Copies(1));
PrintService pss[] = PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.GIF, pras);
PrintService ps = pss[0];
System.out.println("Printing to " + ps);
DocPrintJob job = ps.createPrintJob();
FileInputStream fin = new FileInputStream("filename.gif");
Doc doc = new SimpleDoc(fin, DocFlavor.INPUT_STREAM.GIF, null);
job.print(doc, pras);
fin.close();
}
}
这是运行是出现的问题:
Printing to Win32 Printer : \\192.168.122.182\EPSON TM-T88III Receipt
Exception in thread "main" javax.print.PrintException: java.awt.print.PrinterException: RPC 服务器不可用。
at sun.print.Win32PrintJob.printableJob(Unknown Source)
at sun.print.Win32PrintJob.print(Unknown Source)
at my.Main.main(Main.java:32)
Caused by: java.awt.print.PrinterException: RPC 服务器不可用。
at sun.awt.windows.WPrinterJob._startDoc(Native Method)
at sun.awt.windows.WPrinterJob.startDoc(Unknown Source)
at sun.print.RasterPrinterJob.print(Unknown Source)
... 3 more
打印机打印其他文件的时候可以打印出来,是连在自己电脑上的打印机。
不好意思,因为我自己没有多少分数,只能少给点了。
------解决方案--------------------LZ 这个问你是怎么解决的.....