The "Scanner error 2" is a common problem on the HP Color LaserJet 2820 and 2840 series printers. The general advice is to turn the printer on and off, and see if the error resolves. If the "Scanner error 2" keeps coming back, you should replace the flatbed scanner assembly.
To fix HP scanner not working follow this steps-
-Check the connection issue.
-Enable Windows Image Acquisition (WIA) service and associated services.
-Update your scanner driver.
-Troubleshoot hardware problems.
-Run System File Checker.