I have been working at this for a week no with no luck and I am not sure if I am going about this the correct way. I have gone through the examples that Tanu has posted about https://www.esri.com/arcgis-blog/products/arcgis-enterprise/uncategorized/printing-popups-from-web-application/Printing Popups from Web Application, etc but nothing seems to work.
I don't want to create another web application just to print this information so what we are looking for is to have a hyperlink in the features popup (shown below) that opens a new page with the objectid in the URL. I'd like to automatically generate a PDF with clicking on "Generate Map" that displays the feature that has a matching objectid to what is in the URL along with some additional layers and a few important attributes below the map.
Right now I have a php file that opens up an HTML page that displays a map with the feature layers along with the attributes that queries the objectid in the URL but I cannot get the map to display only that feature.
Another route I have taken is to publish a printing service that has a template I created but I am unable to pass any of the attributes to the layout.

Does anyone have any tips or information on how to do this? I am a novice when it comes to JavaScript, ArcPy, etc .