Hi,
The drivers on the HP support page for this printer are for very old Mac operating system versions.
Apple has an HP 5.1.1 Printer Software Update - Apple Support download page, where an HP Photosmart C4700 series is listed in the referenced Printer and scanner drivers for Mac - Apple Support article. The problem is that it says "Not compatible with macOS v12 and newer" (it may or may not work with a later version, but that would be entirely experimental).
Talking about experiments, the HP PhotoSmart c4780 All-in-one Printer is listed as supported by a Linux driver (HPLIP): https://developers.hp.com/hp-linux-imaging-and-printing/supported_devices/index .
The replies by Techguyuk in Can’t print with iPadOS17 - Apple Community about using a Raspberry Pi Linux print server could possibly be of interest to you. The idea is to allow printing in an AirPrint-like way from macOS Sonoma computers or iOS/iPadOS devices to a non-AirPrint (USB) printer.
As always, make sure that you have backup copies of all important files before testing anything.