I tried running a long USB cable from the iMac to the HP printer and that would not connect either.
The printer you are using has support for the latest MAC OS X 10.8 operating system. The package is available from the official support page at HP. After you download the required package, double click it and follow the instructions on the screen. I think you will need to uninstall the old programs related to the printer as you will be replacing them with new and updated ones.