Detecting printer off-line and other printer problems

Hello All,

I have tried unsuccessfully to find out how to check for printer
off-line, printer out of paper and such like with a view to preventing
calls to BeginDoc until the problem has been rectified.   I want to
avoid having to wait, for example, until the Windows dialog offering
'Retry' or 'Cancel' appears in cases where the printer is off-line.

I would be most grateful if anyone can advise me on how best to trap
these circumstances.

Thanks in advance for any help you can give.

John