Is your laptop randomly turning off? There are various factors that can cause this issue such as a glitch in its operating system, overheating, low battery health, or even a hardware component failure ...
Power supply issues are the main cause of this problem. If your computer or printer is not directly connected to the main power source, say they are connected through a UPS, the UPS might be faulty.