Welcome to HP Support Forums. 🙂 I came across your post and would like to help.
I understand that you have an HP OfficeJet 5740 e-All-in-One Printer. i read that the printer is stuck on 5x7 photo paper and you're unable to switch it back to regular 8.5x11 inch paper size. You tried switching back to factory settings and that did not help. You've done a remarkable job performing the steps.
To provide an accurate resolution, I need a few more details:
Do you face this issue while printing or while copying?
Did any software changes or updates happen for the printer recently?
Are you using Windows or Mac?
Meanwhile, I recommend you to perform the following steps to isolate the issue and arrive at a fix:
Disconnect the power cable from the printer while the printer is still ON.
Disconnect any other cables if connected the printer.
Press and hold the printer’s power button for 15 seconds.
The printer should be directly connected to the wall outlet and not to a surge protector. Reconnect the power cable to print and the printer should power ON by itself. If the printer doesn’t power ON then please manually power it ON.
For Windows, please download and run the HP Print and Scan Doctor software. This is a free tool for Windows to help resolve issues with the printer drivers.
If the issue still persists while printing then you may uninstall the printer drivers from the root level and then reinstall them. The following steps will help: