Buy Now
Sign in

FAQ search

How can I use the TCPDF action in CFv5?

Published: Thursday, 23 April 2015 10:35

The TCPDF action allows you to create a PDF including the results submitted from the form in a similar way to creating a form email.

  1. Get the TCPDF action for CFv5 from the Downloads page here.
  2. Use the Install Action icon in the Forms Manager to upload and install the action. You should then see it in the Data Management actions group in the Setup tab of the Form Editor.
  3. Drag a copy into the On Submit event of your form as the last action.
  4. Edit the action and put something in the Contents box at the bottom of Basic tab. A quick way to do this is to copy and paste an Email template from the same form.
  5. Save and test. Then edit as needed.

Note that if you have the View set to anything other than Save to Server this must be the last action as it takes over control of the process from ChronoForms so CF can't do anything else.

For more information on the TCPDF settings please see this CFv4 FAQ

Including images

You can include an uploaded image but to do so use a relative URL for the image src and use double quotes around it (single quotes will not work in TCPDF). For example

<div><img src="/components/com_chronoforms5/chronoforms/uploads/form_name/{image}" /></div>

Setting the file name

IN CFv5 you can preset a file name for the PDF action using a Custom Code action before the TCPDF action like this example:
$form->data['pdf_file_name'] = $form->data['firstname'].'_'.$form->data['lastname'].'_whateverelse';
Thanks to user HerKle for this.