Menu

Detect a printer with paperclips

2007-08-04
2013-04-10
  • Vicente Rico

    Vicente Rico - 2007-08-04

    Hello!!!

    In my program, i use paperclips. But, when a user don´t have a printer installed in the system, the program exits.
    Is there any form , i can detect if the user has a printer installed???  Thanks!!!

     
    • KewlWater

      KewlWater - 2007-08-04

      Hi,

      SWT offers methods to check if a printer is installed or not... e.g.

      if (Printer.getPrinterList().length == 0)
      {
         // no printer installed
      }

      Regards,
      CoolWater

       
    • Vicente Rico

      Vicente Rico - 2007-08-04

      OK.Thanks  .. I' ll try that. Thanks for your fast reply...

       
      • KewlWater

        KewlWater - 2007-08-05

        Maybe it would be better to use s.th. like this to avoid NullPointerException

        if (Printer.getDefaultPrinterData() == null)
        {
            // no printer installed
            // From swt help: Returns a PrinterData object representing the default printer or
            // null if there is no printer available on the System.
        }

        Regards,
        KewlWater

         

Log in to post a comment.

MongoDB Logo MongoDB