I would like to be able to print individual webform submissions to PDF.
I have attempted to do this by creating a View Page to show individual submissions. e.g. http://website.localhost/webform/submission/25 using the webform_views module and the "Webform submission: Rendered entity" field to the display results.
The page displays great but when using the entity_print module to add a "view pdf" link on the page, the pdf is generated but it is blank.
I have tested the entity_print module on other page views and the PDF's are generating with content and I am now struggling to find an answer to why the webform_views data wont print to PDF.
I have created an issue for this https://www.drupal.org/node/2883205 but I am wondering if there is a smarter way I can achieve the printing of an individual submission to PDF directly with the webform module and not requiring webform_views.
Comment | File | Size | Author |
---|---|---|---|
#2 | print_individual-2883402-2.patch | 1.81 KB | jrockowitz |
|
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe entityprint.module module is looking a 'full' view mode, which was not supported by webform submissions.
The attached patch defaults any missing view mode to 'html' and outputs the submissions data with the submission information.
I think you are going to have write some custom preprocessing logic, templates, and CSS to make the output look pretty.
Comment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch. Please download the latest dev release to review.
Comment #4
danjordan CreditAttribution: danjordan commentedThanks. I can confirm patch worked for me.
I did have to install the patch manually. When I updated the module via composer it said it updated with latest dev version but the patch was not implemented as part of the update.
There was a permission issue with webform images when generating the PDF's. The message was
"Error generating document: Failed to generate PDF: Image type unknown http://website.localhost/system/files/webform/service_checklist/27/test_..."
I had to enable the permission "View any webform submission" for "Anonymous User" for the PDF's to be created and including the image. Not sure if that is an issue with WebForm or Entity Print. I will open a new issue for it.
Thanks again Jacob.
Cheers
Dan
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedPermissions problem should be handled in a new ticket in the Entity Print module's issue queue. If this is a Webform related issue the Entity Print module's maintainer can reassign it to the Webform module.
Comment #6
danjordan CreditAttribution: danjordan commentedThanks. I have created a ticket for the issue. https://www.drupal.org/node/2883614
Comment #8
benjy CreditAttribution: benjy at PreviousNext commentedI don't fully understand the use cases but there is the chance you can have the HTML view mode with and without submission information, is that correct?
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe Submission information (and navigation) is automatically include via \Drupal\webform\Controller\WebformSubmissionController::index.
Comment #10
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented