I have sereval webforms et each webform send a mail with a pdf. I would like to do a template for each webform. I use webform2pdf in Drupal 7 to send pdf by email. How can i do that ?


I'm working with this module right now too.

Once the module is enabled (and the required tcpdf library is intalled), you will see a new "Generate PDF" tab when editing each of your webforms. This is where you can add your PDF template under "Content of the PDF Document"

If you enter stuff here, it overrides anything you may have set globally (under /admin/config/content/webform2pdf).

You can use html and tokens here, for example...

<p>INTERN NAME: [submission:values:intern_name]</p>

I hope this helps.

If you get this working, maybe you (or somebody reading this) can help me with a problem I'm having: I want to add conditional logic for some of my fields so they only show up in the PDF if a value is entered.

I tried this via the interface (I have PHP filter module installed), but it resulted in a completely blank PDF, so now I'm going to try doing a template override instead.

| improve this answer | |
  • Thanks Anne for your response. I need use php too to do my template. In fact, i must do tables in my pdf with a lot of fields. I thought that i could use a hook to do that but i can't. – cel57 Aug 31 '16 at 8:47
  • Anne, i tried to use php filter in content of body and i can do it. I have a pdf with information. I test that : <table border="1"> <?php for($i=0;$i<5;$i++){ echo "<tr><td>".$i."</td></tr>"; } ?> </table> Are you PHP Code in drop down list Format text ? – cel57 Aug 31 '16 at 9:14

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.