Hi,
First of all, try to reset the printing system and re-add the printer.
Reset the Mac printing system to solve a problem - Apple Support
Add a printer on Mac - Apple Support
Check whether the operating system suggests a suitable driver. If necessary, try to use a driver for a similar HP printer model.
When looking for similar printers, the article https://www.ibm.com/support/pages/information-printers-hp may be useful for comparing data streams (the DeskJet 842c appears to use HP PCL 3).
You could perhaps try a macOS generic PCL driver.
You may also want to check whether the Dec 11, 2020 HP Printer Drivers v5.1 for macOS download from Apple at https://support.apple.com/kb/DL1888?viewlocale=en_US&locale=en_US contains something useful.
Apparently, there is a Gutenprint driver for the 842c as well.
If you have to carry out experiments with drivers for an old printer, be aware of the risks. Software conflicts cannot be ruled out. Data may be lost. You may have to erase and re-install everything on the computer. A hardware problem is unlikely, but it is impossible to guarantee anything. So, before proceeding, make sure that you know what you are doing. Having at least three backup copies of important files (photos, etc.) is essential.
Be careful when you download drivers from the Internet. Use official printer manufacturer sites, or other trustworthy sites (such as Apple).
If you wish to connect the DeskJet 842c as a network printer, it can possibly be arranged via a small external print server (connected to the USB or parallel port of the printer). Such (used) devices can often be found via an online auction site. A print server with an Ethernet port could be connected to one of the LAN ports of a Wi-Fi router. There are also print servers with built-in W-Fi connectivity.