Documentation
Setting up Creative PDF Templates
Installation, configuration and use, step by step.
Install the module in Dolibarr
- Download the module ZIP file (named
module_xxx-version.zip), for example from the Dolistore. - In Dolibarr, open Home > Setup > Modules/Applications > Deploy/install external app/module.
- Upload the ZIP file, then enable the module in the list of modules.
- Try it on a copy of your data first, and keep a backup before any update.
Prerequisite: a PDF engine
Creative Templates draws your documents in HTML and CSS, like a web page. To turn them into a PDF identical to what the editor shows, it relies on a rendering engine installed alongside Dolibarr. Three engines are supported:
- Gotenberg (recommended): a Docker service that embeds Chromium. The PDF is identical to the editor.
- Chrome or Chromium installed on the server: the same rendering, without Docker. PHP must be able to run programs (exec function allowed).
- TCPDF, built in: nothing to install, but very limited CSS. It serves as a fallback engine, and the premium designs in the catalogue are not rendered correctly with it.
The PDF engines tab of the module setup detects the engines present on your server and gives the same installation examples as this page.
The following commands are run in a terminal on the server, with administrator rights. A wrong move can make the server unstable or expose a service on the network: if in doubt, call on your hosting provider, a system administrator, or our support services.
Install Gotenberg with Docker (recommended)
The recommended production setup: local listening only, authentication, and Chromium without network access, since all the document resources are sent with the HTML. Create this file, replacing the password:
# /opt/gotenberg/docker-compose.yml
services:
gotenberg:
image: gotenberg/gotenberg:8
restart: unless-stopped
ports:
- "127.0.0.1:3000:3000" # local access only
command:
- "gotenberg"
- "--api-timeout=60s"
- "--api-enable-basic-auth" # reads the 2 environment variables below
- "--chromium-deny-private-ips" # Chromium cannot reach the internal network (SSRF)...
- "--chromium-deny-public-ips" # ... nor Internet: all resources are sent with the HTML
- "--log-level=warn"
environment:
GOTENBERG_API_BASIC_AUTH_USERNAME: dolibarr
GOTENBERG_API_BASIC_AUTH_PASSWORD: "change-me"Start the service, then check that it responds:
cd /opt/gotenberg && docker compose up -d
curl -s http://127.0.0.1:3000/health
curl -s http://127.0.0.1:3000/versionIf Dolibarr itself runs in Docker, the Gotenberg URL is http://gotenberg:3000 (same network). Allow about 1 GB of memory for Gotenberg and update the image regularly with docker compose pull, as it embeds Chromium.
Install Gotenberg for a quick trial
On a development machine, a single command is enough. It is not meant for production: no authentication, and without the 127.0.0.1 address the port would be open on all interfaces.
docker run --rm -p "127.0.0.1:3000:3000" gotenberg/gotenberg:8Install Chrome or Chromium on the server
The same rendering as Gotenberg, without Docker. PHP must be able to run programs (exec function allowed). If the program is not found, enter its path in the module’s Settings tab.
apt install chromium # or google-chrome-stable from the Google repository
chromium --headless=new --versionInstall a converter for the catalogue thumbnails
The design catalogue shows the first page of each template as a thumbnail. A single converter is enough. Without one, the catalogue displays a placeholder image, and the PDF preview of each design remains available.
pdftoppm (recommended): the simplest and lightest. PHP must be able to run programs and, if open_basedir is used, access the /usr/bin folder.
apt install poppler-utils # dnf install poppler-utils on RHEL / Rocky / Fedora
pdftoppm -vGhostscript: often already present on servers, with the same conditions.
apt install ghostscript
gs --versionImagick: no program to run, but ImageMagick refuses PDFs by default. They must be allowed for reading, which applies to everything using ImageMagick on the server: only choose it if the exec function is disabled.
apt install php-imagick ghostscript
# ImageMagick refuses PDF by default: allow reading them (policy.xml of ImageMagick 6 or 7)
sed -i 's/rights="none" pattern="PDF"/rights="read" pattern="PDF"/' /etc/ImageMagick-*/policy.xml
# then restart PHP: systemctl restart php8.x-fpm (or apache2, the PHP service of your server)Set up the module
- In Dolibarr, open Home › Setup › Modules, then the Creative Templates setup.
- Settings tab: choose the main engine (Gotenberg or Chromium) and the fallback engine, then enter the Gotenberg server URL, its username and its password.
- PDF engines tab: click “Test”. The demo document (flex, grid, long table, QR code, numbered header and footer) must come out without errors.
- Open a quote or an invoice: your templates appear in the card’s PDF template list, next to the standard templates.