HP all-in-one units are actually separate devices connected by an internal USB hub. That is why the scanner can work fine but the printer might not.
To fix it, I would first download the latest driver from HP and install it. If that does not work we can get into some more detailed troubleshooting.