I got both printer and scanner to work on my iMac.
I went to HP Support and searched and found " 'HPxxxxx.framework' will damage your computer," which is one of the many error messages I have received.
https://h30434.www3.hp.com/t5/Printers-Knowledge-Base/quot-HPxxxxx-framework-quot-will-damage-your-computer-quot/ta-p/7825233
As instructed, I made sure my OS was up to date.
I followed the instructions to Download HP Easy Start. (Note, the first HP Easy Start link worked, but the second link did not)
Critical: After downloading this, do not go directly to installing the drivers. Follow the instructions which say "The following should not be necessary but if you want to be extra diligent and guarantee a clean new install."
As instructed, click on the HP Easy Start menu and select Uninstall HP Software. I did not do that the first time and the remaining HP files on my computer allowed me to get the printer working, but not the scanner.
After uninstalling HP software, I followed the instructions to download the Essential files and HP Easy Scan.
One of the final steps is to test the Printer (worked the first time) and Scanner (got an error message.) I tried the scanner again and the document I was scanning appeared in the Easy Start test area. Then, I tried Easy Scan and it worked also.