How can I grant permissions to anonymous users per session to download a file?
Take a look at Webform protected downloads. It's a module I wrote a while ago to tackle this kind of situation.

Edit: Ah, sorry, just read your question again. The part with the modified pdf content depending on user input is not addressed by my module. Though, as the system uses the private file system you could maybe hook into there. This is not trivial though.

I see another easier option. You create a custom menu callback and use webform hooks or the redirect configuration of the webform to send the user to this url that contains the submission id of the webform (say, special-pdf-access/SUBMISSION_ID). With this information you can load the submission, thus accessing all the data entered by the user, then create a pdf file with this info and display a link to that file.

You have to pay attention to security though, so as not to allow arbitrary users to load pdf files they shouldn't have access to. For this you can use the global $_SESSION variable, to store the submission id after webform has processed the submission, and then check in the custom menu callback if the submission id in the session equals the requested submission as given in the url.