Welcome to the HP Forums
I would like to take a moment and thank you for using this forum, it is a great place to find answers.
As I understand the printer gets online after a hard reset but switches back to offline repeatedly,
No worries, as I'll be glad to help you, that said, I'll need a few more details to dissect your concern & provide an accurate solution:
Have you upgraded the firmware of the printer?
(Click here to find and install if you haven't done it yet)
While you respond to that, here's what you need to do:
Step 1: Use HP Print and Scan Doctor to check connectivity
If you have Windows 8 or 10, use HP Printer and Scan Doctor to automatically fix several types of problems that can cause the printer to go offline. Skip to the next step if your computer does not have Windows 8 or 10.
From the computer you are trying to print from, download and run HP Print and Scan Doctor. When this link is clicked, HP Print and Scan Doctor is downloaded using your Internet browser's download capabilities.
After opening Print and Scan Doctor, read and respond to the screens to resolve the problem.
NOTE:
For network printer connections, make sure and select Test Print to test the connection, and then select No Print after the test has completed to obtain a solution.
If the printer continues to go offline, continue to the next step.
Step 2: Set the default printer and unpause printing
The default print driver might have changed from the driver you installed to another driver, such as a Web Services for Devices (WSD) driver with a very similar name. Change the default print driver to your originally installed driver and confirm the printer is not set for offline use.
CLICK HERE FOR MORE STEPS AND INSTRUCTIONS.
(By the end of this article all the issues should be resolved)
Keep me posted,
If I have answered your queries, feel free to give me a virtual high-five by clicking the 'Thumbs Up' icon below,
Followed by clicking on "Accept as solution" button for my efforts to help you.
Have a great day!