Score:0

Let anonymous user download pdf off his own webform submission

ng flag

I have configured entity_print with webform for D8 and can download a submission as pdf from the submission view.
Now I tried to let anonymous users fill out a form and added a link to the pdf on the confirmation page. I checked the show own submissions for guests on the permission page of that webform.
But when I try to access the pdf with the submited data I get a permission denied message.
http://mywebsite/print/pdf/webform_submission/15?view_mode=html seems not to do the trick.

The use case just is: Display a confirmation page with the submitted values to the user and let the user download it as pdf. Any hints on that?

Meanwhile I found this Thread: https://www.drupal.org/project/entity_print/issues/2896424 Which says adding
{{ content[0]['#webform_submission'].data.FIELD_NAME }}
too the template should work. While Fieldname should be the name of the entityPdf/Attachment field. But adding it to my webform-confirmation.htmltwig template does not return anything.

This too points in the same direction: https://www.drupal.org/project/webform/issues/3198932 This seems to be a solution. After Doing the following:

  1. Add permissions for anonymous users - "Webform submission: Use all print engines"
  2. Enable "Allow users to view a submission using a secure token"
  3. Add Link to submission with token [webform_submission:token-view-url]
  4. Submit Webform as anonymous and click on link -> Download PDF

Maybe there is still a even more neat solution...

Okay meanwhile - the so called secure token isn't expiring so it es more like a everyone how knows the link not so secure token :-(

Score:0
ng flag

Okay after playing around with several options, best way in my eyes is:

  • install entity print and wktmltopdf
  • give guest users access to their own submissions (/admin/people/permissions)
  • give guest users access to use any print engine (/admin/people/permissions)
  • add a confirmation message like "Thank you for contacting us, you can download your submited data here (at /admin/webform/manage/kontakt/settings/confirmation)
  • The href to the PDF looks like this: /print/pdf/webform_submission/[webform_submission:sid]

The access to the data will no longer be posibble after session timeout. So there shouldnt be a concern with data security.

The Secure token method mentioned above would fail in cases where data security plays a role, as the token never times out and could easily be obtained from browser istory.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.