Your device can go offline due to several reasons. You may not have enabled the online mode, for instance. This needs to be manually done. On a Windows system, you should enter Devices and Printers in the Control Panel. After clicking on See What’s Printing, go to Printer and enable the online mode.
However, since the reasons can be varied, you can also depend on the fixes on this link to get rid of the issue: