PDF Generator Add On.

The PDF Generator add-on allows you to generate PDF files with the information collected by the forms, and send them as attachment of notification emails.

The PDF Generator add-on uses HTML to format the files' contents, combined with the form fields. To refer the form fields use the structure {field.field-name}

Ex. <p>Your name is: {field.user-name}</p>

We use HTML because it is easy to learn but powerful programming language.

The PDF Generator add-on is accessible through the "Contact > Extensions" menu option.

Extensions Section
Extensions Section.

The initial screen of the "PDF Generator" includes the list of forms where the add-on is being used and a section to integrate the add-on in other forms.

Initial Screen
Initial Screen.

The add on - form integration screen appears by pressing the "settings" or "add" buttons in the initial screen.

Intergration Settings
Integration Settings.

The attributes list:

  • Enable: allow enabling/disabling the PDF generation into the form.
  • Filename: enter the PDF file's name. It can include a prefix generated dynamically to avoid conflicts with other PDF files generated previously.
  • File content: enter the HTML tags to format the PDF structure and content. This attribute is an HTML editor with syntax highlighting and errors detection. The HTML code used to generate the PDF file must be well-formed. It supports the "Conditional Fields for Contact Form 7" plugin tags if the "Conditional Fields for Contact Form 7" plugin is installed on the website
  • Fields list: It is an informative section with the names of form fields.
  • Protect the file and password: These attributes allow you to protect the files.

Tips and Tricks

For PDF in Chinese or Cyrillic:

For texts in Chinese, include a <head></head> section after the <html> tag, tag, with a block of styles to import a font file for Chinese characters, as follows:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
@font-face {
font-family: 'Firefly Sung';
font-style: normal;
font-weight: 400;
src: url(http://eclecticgeek.com/dompdf/fonts/cjk/fireflysung.ttf) format('truetype');
}
* {
font-family: Firefly Sung, sans-serif;
}
</style>
</head>

For Cyrillic characters, the header is:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
@font-face {
font-family: 'dejavu';
font-style: normal;
font-weight: 400;
src: url(https://cdn.jsdelivr.net/npm/dejavu-sans@1.0.0/fonts/dejavu-sans-webfont.ttf) format('truetype');
}
* {font-family: dejavu;}
</style>
</head>

To include a page break before some text or content:

Use an inline style tag with the css rule page-break-before: always;

Ex. assuming there is a paragraph in text, and you want to start in a different page of the pdf file:

<p style="page-break-before: always;">
Text here...
</p>

To include the page's break after the paragraph use the CSS: page-break-after: always;