Create PDF of formatted mail and attach PDF to mail
This feature is part of the Visforms Subscription and not available in the free Visforms version..
We propose reading the documentation from the beginning, starting with the Introduction We will not repeat concepts and explanations made in previous parts of the documentation, here.
This Plugin allows you to create a PDF file from the formatted mail and to attach the PDF file to the mails. Please note: If you have not enabled the Options "Email Result" (for the result mail) and "Email Receipt" (for the receipt mail) in the form configurations tab "Mail Options" no PDF's can be created.
If you have set up the form in a way, that a result mail and/or a receipt mail is sent and if the plugin is enabled, the plugin will automatically create a temporary PDF file from the formatted mail. Using the plugin options you can control whether the PDF files are attached to one mail or the other.
Options for the result mail
You can attach both PDF files to the result mail. Just enable the respective option.
Options for the receipt mail
You can only attach the PDF of the receipt mail to the receipt mail. Just enable the option.
The plugin will remove the temorary PDF files from your server, after the mails are sent.
What is possible
Visforms creates html mails. In order create a pdf file, the html code has to be converted into pdf, because html and pdf are totally different formats. In order to achive this task, Visforms uses the popular and widely used Open Source PHP Library TCPDF.
This library has a simple parser, that tries to translate html into pdf format. Other than browsers or mail clients, which do support html and css specifications widely, this pdf parser only supports a little subset of the HTML and CSS specification and, even in supported stuff, it's probably not as perfect as in first class web browsers. Especially css properties like margin, padding or float are not supported by the parser. Therefore you should only use very basic html and no advanced css features in your mails, if you want to create matching pdf's from the mails.
With regards to the text content, mail and pdf should be totally identical.
Adapt pdf file name
Visforms creates standard names for the pdf files. These names are created using the Joomla! language management and can therefore at least partly be individualizes using the Joomla! Feature "Language Overrides". If you create an override for the file name this name will be used in all forms.
Name of result mail pdf
The file name of the pdf created from the result mail comes form the following translation rule: PLG_VISFORMS_VFMAILATTACHMENTS_RESULT="%s-resultmail".
%s is a placeholder for the form name, and is replaced with the form name during the translation process, while -resultmail is a fix part of the file name. You can change the file name by adding a custom translation for the language key PLG_VISFORMS_VFMAILATTACHMENTS_RESULT.
Name of receipt mail pdf
The file name of the pdf created from the receiptmail comes form the following translation rule: PLG_VISFORMS_VFMAILATTACHMENTS_RECEIPT="%s-receiptmail".
%s is a placeholder for the form name, and is replaced with the form name during the translation process, while -receiptmail is a fix part of the file name. You can change the file name by adding a custom translation for the language key PLG_VISFORMS_VFMAILATTACHMENTS_RECEIPT.
Create Override
- Select Extensions->Languages(s)->Overrides in the administraion of your website
- Set the Filter, on the left side, to the language of your website and "Site" (not Administration), see red arrow
- Click New button
- Enter PLG_VISFORMS_VFMAILATTACHMENTS_RESULT or PLG_VISFORMS_VFMAILATTACHMENTS_RECEIPT as "Language Constant" (depending on what file name you want to change
- Add your custom file name in the "Text" Option. If you want to use the form name in your file name, you can us %s for this task. If you want to us a fixed filename, just enter this name.
- Click "Save & Close"
- Repeat for the other mail type, if you want to change the pdf file name for the other mail, too
Examples
Form name | Text | Pdf file name |
---|---|---|
form1 | %s-resultmail | form1-resultmail.pdf |
form1 | mycustomname | mycustomname.pdf |
form2 | another-custom-name%s | another-custom-nameform2.pdf |