If your printer is connected using the USB cable, you need to check and make sure that your device is properly connected. You must connect the cable to the PC through a working USB port.
If your printer is connected using the wired network, you need to check and make sure that cable is connected to ethernet cable properly. All the ports must be working fine. The loose, broken, or old cable could also be the reason that your Printer connected but offline. You need to replace them all.
If the device is connected through a wireless network. You need to check and make sure that the printer is properly connected to wifi and its working.