PrinterJob
Hi I am trying to print a job using printer job.
through program I need to invoke the printer job and give the file name to be printed . it is giving exception at pj.print();
code is as follows
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setCopies(2);
System.out.println("usernmame=" + pj.getUserName());
pj.setJobName("C:\\Reports\\GruntalGenerated3598.pdf");
pj.print();
exception is as follows
ava.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:417)
at java.awt.print.Book.getPage(Book.java:158)
at java.awt.print.Book.getPageFormat(Book.java:68)
at sun.java2d.RasterPrinterJob.printPage(RasterPrinterJob.java:588)
at sun.java2d.RasterPrinterJob.print(RasterPrinterJob.java:342)
at ParallelCrystal.TestReport.invoked(TestReport.java:118)
at com.sssw.srv.busobj.AgoInvoker.fireInvokedListener(AgoInvoker.java:71)
at com.sssw.srv.resources.AgInvokerResource.post(AgInvokerResource.java:282)
at com.sssw.srv.resources.HTTPResource.perform(HTTPResource.java:1260)
at com.sssw.srv.http.httpd.perform(httpd.java:4418)
at com.sssw.srv.http.Client.processRequest(Client.java:881)
at com.sssw.srv.http.Client.loop(Client.java:1215)
at com.sssw.srv.http.Client.runConnection(Client.java:1419)
at com.sssw.srv.http.Client.run(Client.java:1379)
at java.lang.Thread.run(Thread.java:484)
Did i made any mistake or should I add some more code
Can some body help me to print this job successfully.
Thanks in advance
Reddy

