26 July, 2013

How do I default printer service in java ?


Code :


package experiment.java.printing;

import javax.print.PrintService;
import javax.print.PrintServiceLookup;

public class getDefaultPrinter{
    public static void main(String str[]){
        try{
        //Get print server as your local setting ( Printer)
        PrintService services = PrintServiceLookup.lookupDefaultPrintService();          
        System.out.println("Default Printer Name ::"+services.getName());
       
    }catch(Exception e){
        System.out.println("Error in get Default Printer service::"+e);
       
    }
       
    }
   
}


No comments:

Post a Comment