In some cases, printer not working error occurs due to firewall and antivirus. This problem usually occurs when users are using the network printer or WiFi. To check whether the antivirus or firewall is causing you trouble, you can disable them for a while and check the printer connection.
After that, you need to install the third-party antivirus software. After that, check again whether the problem is still there. If removing the firewall and antivirus fix the problem, you must consider this solution to troubleshoot the error.