Plugin - PDF (Attach an automatically generated PDF to an email)

Based on the PHP dompdf library, the RSform!Pro PDF plugin is designed to generate PDF files that include submission information. The PDF files can then be attached to the built-in User and Admin emails or accessed via special placeholders.

RSform!Pro PDF plugin video tutorial:

Minimum requirements (same as dompdf requirements)

  • PHP 5.0+ (5.3 recommended)
  • MBString extension
  • DOM extension

Please check with your hosting provider first if you meet the minimum requirements.

The plugin can be installed via the usual Joomla! installer. You can read more on this process here.

Once the plugin has been installed and published, the following configuration parameters are available within the Components > RSForm!Pro > Configuration > PDF area:

  • Font: the font type that will be used to generate the PDF files
  • Orientation: sheet orientation - portrait / landscape
  • Paper Size: the paper format, e.g. A4


Some special chars are not supported by all PDF font types. For example if your submissions or PDF text will be in Chinese, you will need to use the special, Firefly font. For languages that use UTF-8 chars, you can use the DejaVu Sans. Both font files are available for download within the My downloads > RSform!Pro > View all plugins and modules > RSform!Pro files > 3rd Party area.

To install additional fonts, simply upload them (using a FTP client) within the administrator/components/com_rsform/helpers/pdf/dompdf8/lib/fonts/ folder. Once the files have been added to the proper location, you will be able to select the desired font within the RSForm!Pro > Configuration > PDF area. Please note that this is only available for the fonts downloaded from our website, to install fonts obtained from any other source, please consult the dompdf documentation.


PDF layout and content configuration

Accessing the User / Admin email configuration areas will reveal the PDF configuration area. Simple configuration options are available:

  • Attach to email: if enabled, the generated PDF file will be attached to the User / Admin email.
  • File name: the name of the generated file.
  • PDF Layout: allows you to specify the actual content and layout of the generated PDF file. You can use use standard HTML along with the usual RSform!Pro placeholders (listed by clicking on the Toggle Quick Add button)
  • User Password (optional): Set a password that you can pass on to your users. The options selected in the Allowed Options field (explained below) will be applied for users who view the file using this password.
  • Owner Password (optional): Set a password that you can keep for yourself or other administrators. When logging in with this password, you will have complete freedom in editing the PDF file.
  • Allowed Options: Print the document / Modify the document / Extract contents (copy) / Comment in the document - Use CTRL + Click to select the permissions that you wish to associate the generated PDF file with. These will be applied for users who view the file using the User Password and even if no passwords are set for the file.

Limited CSS control is also provided. You can read more on the dompdf CSS compatibility here.

In order to display images in the PDF you will need to use the exact site path. To simplify this process we have added the {sitepath} placeholder.

Instead of:

<img src="" alt="My image" />


<img src="{sitepath}/path/to/images/my-image.jpg" alt="My image" />

Starting with rev. 45, a new placeholder was added, {your_field_name:localpath}. When used, this placeholder will return the local path of the image found on the server (eg. /home/public_html/path/to/uploaded/image.jpg).


<style type="text/css">
h1 {
 margin:3px auto;
p {
 <h1>Sample content here</h1>
 <p>Dear, {Name:value}, thank you for taking time to submit the form.</p>
 <img src="{sitepath}/images/sample.jpg" width="130" height="80" alt="Sample"/>

The generated PDF files don't necessarily need to be attached to generated emails. These can also be accessed via the {user_pdf} and {admin_pdf} placeholders. You can use them inside the RSform!Pro generated emails, Thank you message, Submissions View menu item (details view) and the Submissions directory area (details view and emails). The above placeholders will return the exact path to the PDF document, you could use them in a general link tag in order to create a link to the PDF file, for example:

This is a link to the <a href="{user_pdf}">User PDF</a> document.

RSForm!Pro takes things further and allows dynamic control over the generated PDFs. Basically, you can use PHP code spinets to control the content of generated PDF. This can be done via the specialized PHP PDF Pre-Processing Scripts area (Components > RSform!Pro > Manage forms > edit a form > Properties, Scripts section), which contains two sections: one for the User email PDF and one for the Admin one.

The following PHP variables can be used for manipulation:

  • $args: array that contains the submitted information.
  • $info: a variable that stores the HTML layout (which will be transformed into a PDF).

Available global placeholders:

  • {global:username} - displays the username
  • {global:userid} - displays the user ID
  • {global:useremail} - displays the email of the user
  • {global:fullname} - will display the Full Name registered for the current user
  • {global:userip} - displays the ip of the user that submitted the data
  • {global:date_added} - displays the date when the form was submitted
  • {global:sitename} - returns the name of your site
  • {global:siteurl} - returns the URL of your site
  • {global:confirmation} - displays the URL used for the submission confirmation
  • {global:confirmed} - displays the status of the submission
  • {global:submission} / {global:submission_id} - returns the ID of the submission

Tip: Adding a page-break

If the size of the PDF exceeds one page, the PDF will automatically display the data on multiple pages. You can have more control over the information displayed on a certain page by using the following syntax:

<div style="page-break-after:always">First page data here</div>
<div style="page-break-after:always">Second page data here</div>
<div style="page-break-after:always">Third page data here</div>
18 Oct 2019
Version 2.0.4
  • Fixed - A Fatal Error was encountered when using both RSEvents! Pro and RSForm! Pro to generate PDF files.
03 Jun 2019
Version 2.0.3
  • Fixed - Prevent browsers from auto-filling the password field.
02 Aug 2018
Version 2.0.2
  • Fixed - Syntax Highlighting was not working.
21 Jun 2018
Version 2.0.1
  • Updated - Bumped minimum requirements to use RSForm! Pro 2.0.13 and Joomla! 3.7.0
29 Jan 2018
Version 2.0.0
  • Updated - dompdf updated to v0.8.2
17 Oct 2017
Version 1.51.5
  • Fixed - JFolder class was throwing an error in some cases.
13 Oct 2017
Version 1.51.4
  • Fixed - Several workarounds added for servers with ownership / permission issues.
06 Feb 2017
Version 1.51.3
  • Updated - {if} scripting can now be used in the PDF layouts.
19 Feb 2016
Version 1.51.2
  • Added - Configuration option to grab resources (eg. images) from remote locations.
03 Feb 2016
Version 1.51.1
  • Fixed - Firefly font was not working in PDF files.
09 Oct 2015
Version 1.51.0
  • Added - Joomla! automatic updates support.
  • Updated - Bumped minimum requirements to use RSForm! Pro 1.51.0 and Joomla! 2.5.28
13 Jul 2015
Version 1.50.5
  • Fixed - 'Firefly' font didn't work.
21 Apr 2015
Version 1.50.4
  • Fixed - Filename set was not being taken into account when downloading the PDF.
06 Apr 2015
Version 1.50.3
  • Fixed - Added a legacy function so that Export to PDF from Manage Directories still works with this plugin.
01 Apr 2015
Version 1.50.2
  • Updated - Tweaked the PDF generation process so that you can modify the $pdf variable in the 'PHP PDF Pre-Processing Scripts' area.
31 Mar 2015
Version 1.50.1
  • Added - Ability to encrypt the PDF through User Password & Owner Password.
  • Added - Can prevent printing, modifying, copying or commenting in the resulting PDF.
  • Updated - dompdf 0.6.1
31 Mar 2015
Version 1.50.0
  • Updated - Deleting a form now correctly removes form's PDF settings from the database.
  • Updated - PDF settings can be backed up and restored.
22 Nov 2013
Initial Release

66 persons found this article helpful.

Was this article helpful?

Yes No
Sorry about that

You Should Also Read

PHP PDF Pre-Processing Scripts HOT

Improving the PDF export for submissions

PDF plugin - tips and tricks

Using the {if} statement with RSForm!Pro PDF plugin

Save PDF file to folder