HP Photosmart: cannot print (File /usr/lib/cups/filter/foomatic-rip-hplip not available)

If you print a test page after installing this printer in Cups, the page does not come out and this message appears:
File "/usr/lib/cups/filter/foomatic-rip-hplip" not available
then run this command to reinstall the printer:
hp-setup
Remove the old printer.