How to know a printer is available?

Questions and answers for designing and implementing forms in Servoy

How to know a printer is available?

Postby e.valstar » Sun Jun 19, 2016 7:35 pm

I want to print a form a use this code:
Code: Select all
   if (application.getPrinters().indexOf(printerName) >= 0) {
      forms.formName.controller.setPreferredPrinter(printerName);
      forms.formName.controller.print(true, false);
   }


When I'm connected to the network that have 'pinterName' it works fine.
But when it's not I got the error (only in the consol)

'Kan document niet afdrukken
> javax.print.PrintException: Printer is not accepting job.'

Seems logical to me, because the printer isn't available.
How can I test this printer is available. It tried it already with a try / catch method, but didn't work out.

Thanks on forehand
e.valstar
 
Posts: 8
Joined: Mon Nov 17, 2014 9:52 pm

Return to Forms

Who is online

Users browsing this forum: No registered users and 3 guests