Rules integration

Last updated on
28 February 2019

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

FillPDF has partial Rules integration. You can use it to fill PDFs with Webform (not Node or Ubercart) data and email them as attachments. For Node and Ubercart data, however, you can still send the user a link to download a filled-out copy of the PDF.

As of 2019-02-27 FillPDF has a patch that enables you to use Node data in Rules.

Basic instructions for filling PDFs using Rules

  1. Configure your PDF settings as usual (admin/structure/fillpdf) and take note of the Form ID (fid)
  2. Add a new rule to react on event such as 'After a webform has been submitted' or 'After saving new content'
  3. Add an action 'Load a FillPDF configuration' using your Form ID
  4. Add an action 'Fill a PDF with webform data' or 'Fill a PDF with node data' (requires patch)
  5. Add an action 'Perform the default action on the PDF' (this will do to the PDF whatever would be done with it by visiting the usual fillPDF link)  OR  'Save PDF to a file' (this will save the PDF to your server in the folder specified on the Additional PDF settings on the PDF settings page
  6. If you have Mime Mail installed you can email the PDF using the rules action 'Send HTML e-mail' using the 'Path to saved PDF' variable in the Attachments data selector.

Turn on the FillPDF Ubercart Starter module that comes with FillPDF 2 (7.x-2.x-dev at the time of writing). You will need the Features module as well, since this depends on it.

The module adds a FillPDF form ID field to your Product content type and sets up Rules to send the customer an email for each configured Product in an order. To configure a Product, you edit it and set the FillPDF form ID to the form ID of your FillPDF form (which you can find by editing it).

Turn on the Rules Admin (rules_admin) module if you want to edit the text used in the e-mails.

Remember that you also have to set up your PDF forms. Here is an example of a simple configuration that works with this module:

Screenshot of compatible configuration for FillPDF Ubercart Starter

(In case you can't see the screenshot, it maps the following tokens to some fields: [uc_order_product:node:title], [uc_order:first-name], [uc_order_product:attributes:Favorite-pet-name].)

Attach the PDF to an e-mail after it's filled and send it

With Webforms:

This is possible by using the default Rule that comes with FillPDF. You need Rules, Webform Rules, and Mime Mail for this to appear. You sometimes have to use the development version of Rules's data conversion features and a bit of PHP to get the tokens and variables you need so everything will work, but it is possible to set things up as you need. In more recent versions of Rules and Webform Rules than this was originally written, this has gotten even easier.

This is being improved (see #1266174: Rules integration).

Help improve this page

Page status: No known problems

You can: