How to know a printer is available?

I want to print a form a use this code:

	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

Hi Valstart,

I see that this is an old post but when I faced this problem some years ago I did a plugin.
Look at https://docs.oracle.com/javase/7/docs/a … State.html

Hope this help

Marco