I am working on project to implementing print in java on network printer, printer is not configured. I am having problem while printer service lookup always returning null.
in Java application, is there anyway to print a file on printer which not configured?
code below is not helping to detect printer.
public int printDoc(InputStream is) throws PrintException, FileNotFoundException {
    PrintService printService=PrintServiceLookup.lookupDefaultPrintService();
    DocPrintJob job = printService.createPrintJob();
    job.addPrintJobListener(new PrintJobAdapter() {
        public void printDataTransferCompleted(PrintJobEvent event){
            System.out.println("transfer complete");
        }
        public void printJobNoMoreEvents(PrintJobEvent event){
            System.out.println("received no more events");
        }
    });
      Doc doc=new SimpleDoc(is, DocFlavor.INPUT_STREAM.AUTOSENSE, null);
      // Doc doc=new SimpleDoc(fis, DocFlavor.INPUT_STREAM.JPEG, null);
      PrintRequestAttributeSet attrib=new HashPrintRequestAttributeSet();
      attrib.add(new Copies(1));
      String printeraddr= "ipp://blrprt01.blr.network18.com/23Flr_Printer1";
      PrinterName prName =new PrinterName(printeraddr, null);
      attrib.add(prName);
      job.print(doc, attrib);
    return 0;
}
 
    