Force Print API to Use Physical Printer
I'm using the print API (javax.print) to print documents that should not be redistributed electronically. Therefore I've set up a method to print to the default print service without showing the user the print dialog.
My problem is that I need to ensure that the default print service is using a physical printer and not some sort of document writer. Does anybody know if this is possible?
My code is basically this:
I'm testing on Windows using a couple physical printers as wells as the CutePDF writer. When I examine the attributes and implementation classes of the PrintService and PrintJob, I can't see any differences between the physical printers and the PDF Writer.
PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob job = ps.createPrintJob();
// do some stuff to get a reference to a Connection (conn) that is streaming my document
SimpleDoc doc = new SimpleDoc(conn.getInputStream(), DocFlavor.INPUT_STREAM.AUTOSENSE, null);
job.print(doc, new HashPrintRequestAttributeSet());
I believe that this is possible somehow -- smartsource.com seems to have accomplished it. If you go to smartsource.com and print a coupon, you'll see that they're using an Applet to send their coupons directly to the default printer (similar to what I want to do with my documents). However, if you change your default printer to the PDF writer, they tell you that it isn't supported.
Any ideas? Any help is appreciated!
Re: Force Print API to Use Physical Printer
hi , everybody. I want to know whether the problem had been resolved :
HOW TO Force Print API to Use Physical Printer ?