2

I'm attempting to use the Fill PDF module to populate an editable pdf. The data source is a Drupal Webform submission. I'm specifying those values to Fill PDF using tokens from the Webform Tokens module. I have also tried this using Webform's tokens made available to Fill PDF via the Webform Rules module, which does not work at all (no PDF is generated).

With the Webform Tokens module I have partial success: I can get a PDF to fill in with non-user-submitted values from the webform (such as the submission ID and the webform component label) but user-submitted values always end up blank. For example:

  1. I enter the following into the Value field of the PDF-Field key in /admin/structure/fillpdf/[form ID]/edit/[pdfkeyname]:

    The SID of this submission is [webform:meta-sid]. 
    The value of the form component titled [webform:meta-label-textmetest] 
    is [webform:val-textmetest].` 
    

For the submission in question the value of the textmetest field is "glasstest."

  1. I go back to /fillpdf?fid=53&webform[nid]=4&webform[sid]=10 and it now reads

    The SID of this submission is 10. 
    The value of the form component titled textmetest 
    is  .
    

Thus, the [webform:meta-sid] and [webform:meta-label-textmetest] tokens are being replaced, but not the token [webform:val-textmetest].

I have confirmed that the webform's ID is indeed 4, the SID is 10, the value of textmetest for SID 10 is glasstest, and the form ID for the pdf is 53.

I know that it is trying to access a specific submission, because if I use a nonexistent SID in the URL (e.g., /fillpdf?fid=53&webform[nid]=4&webform[sid]=99) the field reads: The SID of this submission is . The value of the form component titled is . , i.e. the SID and title don't populate for a nonexistent submission. However, I can't get at the values for any specific submission.

If I try Webform Rules enabled instead, instead using the tokens [webform:sid], [webform:textmetest-value], and [webform:textmetest-title], which are the corresponding tokens that Webform Rules exposes to Fill PDF, it does not even generate a PDF; I get a 500 internal server error.

Does anyone have any suggestions, either for how to make this work or for another way to get at webform values?

1

The issue is that Fill PDF 7.x-1.9 doesn't work with Webform 4 due to a change in the structure of the $submission variable from Webform via webform_get_submission(). See this post for an explanation and an ad hoc fix.

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.