Skip to main content Skip to page footer

Using PowermailPdf

PowermailPdf is a Typo3 extension that fills the entries of a Powermail form into a prefabricated PDF. The PDF may then be downloaded by the user or may be sent to him or her by email.

I am not using composer (a requirement for Powermailpdf), so I had to fiddle.

Powermailpdf relies on FPDFM, a library that does the hard work of merging form data into a premade PDF. Powermailpdf comes with FPDFM in form of a PHAR archive. By using composer, the PHAR archive is ignored and FPDFM gets installed otherwise. Without composer, you have to rely on the PHAR archive. Unfortunately, the archive contains some deprecated code, so with modestly modern PHP versions, you get a warning instead of a PDF. As the PHAR archive is checksummed, you can't patch it the easy way. What helped (on my local machine):

  • Edit PHP conf to allow modification of PHAR archives.
  • Unpack the archive with phar extract -f fpdm.phar
  • Edit filters/FilterASCIIHex.php to replace ord($str{$i}) by ord($str[$i]).
  • Remove the old version of FilterASCIIHex.php from the archive with phar delete -f fpdm.phar -e filters/filterASCIIHex.php
  • Add the edited version of FilterASCIIHex.php to the archive with phar add -c 0 -f fpdm.phar filters/FilterASCIIHex.php (change paths appropriately)
  • Replace the PHAR archive by your edited version.

Then came two obstacles owed to myself. You have to create a folder fileadmin/powermailpdf on your site and you have to put the sample configuration code into the setup section of the template of the page where your form resides. Of course you have to follow all the configuration steps in the PowermailPdf documentation.

Next, the fluid template importing the download link (Web.html) had to be edited. It imported the link by <f:format.html>{answer.value}</f:format.html> and that has to be changed to <f:format.raw>{answer.value}</f:format.raw>. Finally, I removed all the line breaks from powermailpdf/Resources/Private/Template/Link.html. Since then, anything is fine.

To prevent your storage from filling up and to improve privacy, you should also use the extension delete old files. Installation and configuration (scheduler) is straightforward. You have to formulate the path as an absolut path starting at the webroot, e.g. /fileadmin/powermailpdf, and of course you will not delete folders.