My HP printer was automatically detected by Ubuntu but was unable to print anything. You might also encounter issues with your HP printer connecting with Linux machine. The following solution may fix this issue.
try the command hp-setup -i
This HP Linux imaging and Printing System utility will download the required drivers and install the printer successfully.