I arrived here as the issue I have is that the PC / Windows 11 THINKS the printer is offline but it actually isn't! In fact, I spent the best part of my day trying all the HP solutions only to discover the reason I couldn't get the printer Online was because it actually always was online. It's just my PC thinks it's off.
What I found was the PC thinks the printer is offline every time the PC goes to 'sleep'.
The above is the closest I have come to yet to describing the issue. In my case (a Brother printer/scanner connected via ethernet) would show offline even though it was on, not sleeping, and ready for printing. I could sometimes print, but it would be stuck in the queue/spool for a few minutes, showing "error printing", but then eventually print.
I just found, and downloaded the "Network Connection Repair Tool" from support.brother .com and it seems to have found and fixed a problem (reconfigure printer port), so fingers crossed.