Hi,
You do not mention the printer model (nor whether a special app from the printer manufacturer is used), but a Wi-Fi direct connection is not a supported method when using AirPrint. The normal way is to let an iPhone and a printer connect to the same Wi-Fi network (router) in an infrastructure mode.
About AirPrint - Apple Support
Use AirPrint to print from your iPhone, iPad, or iPod touch - Apple Support
If there is a problem with AirPrint after a system update or a network change, the following procedure may be worth testing: Power off the router, the printer, the iPhone, and all other devices/computers. Wait two to three minutes. Power on the router. Wait two to three minutes. Power on the printer. Wait a minute or two. Power on the iPhone. Finally, power on all other devices/computers.