Heeelp 'Selected Printer is not valid'

This error results from the CreateHandleFunc call returning zero. This
is regardless of it have returned a valid valid many times prior to
the failure.
I have found and tried several suggestions from others including
Calling SetPrinter with AdeviceMode = 0
and using
CreateHandleFunc as follows
CreateHandleFunc(PChar(Driver), PChar(AnsiUppercase(Device)),
PChar(Port), DevMode)
all to no avail. I have run out of options. It only occurs with HP4100
PLC5e drivers. Unfortunately many of our clients use this printer.
This error occurs when many print jobs are spooled to the printer.
Sending 1 or 2 jobs will not cause the error.
Any help would be very much appreciated