0

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 :-(

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.