Hello,
I just face a strange problem. I think its not Spring-related, but I hope that someone could help anyway.
I have a PdfPrinter-class used by my SaleService which generates Order-Pdfs via iText and then delegates to PdfPrinter which prints files via Ghostscript which works very well in testcase and when printing a file while server-startup...
When I start my server >>AND PRINT A FILE ON SERVER-STARTUP<< I can invoke the print-method from clients and all files are well printed. I may close and restart one or more clients and can print again without problems...
When I invoke print() from client while NOT printing a file at server-startup, server and client do hang and nothing is printed...
The biggest problem. There is no Exception... Nothing... Simply not printing... :-(
The unknown problem occurs in the line where the printerjob is printed:
when I out-comment this line, the server will obviously not print but it will not hang... So there must be the problem... But as I said, no Exception is thrown...Code:job.print(doc, aset);
here is my implementation of PdfPrinter:
Perhaps there is some serverside printer-init stuff that I missed to enable client-invoked-printing and someone yet had the same problem and could gave me a hint.Code:public class PdfPrinter { public PdfPrinter() {} public static void printPdf(String filename) { System.out.println("filename: "+filename); Doc doc = new PdfDoc(filename); // Gets the format of the document DocFlavor flavor = doc.getDocFlavor(); // Creates a new attribute set PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService(); System.out.println("defaultService: "+defaultService); //PrintService[] services = PrintServiceLookup.lookupPrintServices(dFlavor, aset); DocPrintJob job = defaultService.createPrintJob(); System.out.println("PrintJob created: "+job); try { System.out.println("printing"); job.print(doc, aset); } catch (Exception e) { e.printStackTrace(); } } }
Again. Everything is fine when I print a file on server-startup, but i want to prevent my server from printing a file on every startup to enable printing for clients...
Thanks for help...



Reply With Quote