WebMail Lite Documentation

How to enable saving mails as PDF files

WebMail Lite supports saving messages as PDF files.

The functionality is disabled by default. To enable it, set Disabled to false in data/settings/modules/MailSaveMessageAsPdfPlugin.config.json file.

Also, you need to download wkhtmltopdf package for your operating system from wkhtmltopdf website. Install it and copy the library file under data/system directory, so the path looks like:

data/system/wkhtmltopdf/linux/wkhtmltopdf

or:

data/system/wkhtmltopdf/win/wkhtmltopdf.exe

NB: We don't use system-level wkhtmltopdf binary, instead you need to obtain its static build from the above website. And instead of installing the package, it might be best to unpack it as an archive, get a binary from there and place it at the specified location. Also, you need to make sure the file permissions are set correctly so that the library can be run from within PHP script.

You may need to install additional libraries. In case of CentOS Linux, it's done as follows:

yum install libXrender libXext fontconfig xorg-x11-font-utils.x86_64 xorg-x11-fonts-Type1

In case of Ubuntu, simply install the library on system level as well, so all the prerequisites are installed:

sudo apt install wkhtmltopdf

Once the above steps are done, you should be able to download message files and have them converted to PDF files on-the-fly.

NB: You can also save messages as PDF using Web API.