You are reading the documentation for an outdated Corteza release. 2023.9 is the latest stable Corteza release.

PDF Renderer

To enable PDF rendering, we need to set up Gotenberg. Gotenberg exposes an API to a headless browser that can convert various formats into PDF documents.

Don’t forget to reload the configuration with docker-compose up -d

After the feature is enabled, you will see a Preview PDF button at the bottom of the template editor page.

template preview pdf enabled
Figure 1. The screenshot shows the PDF preview option after the feature is successfully enabled.

Setup Gotenberg

Add the gotenberg service to the docker-compose.yaml file:
# ...

services:
  gotenberg:
    image: thecodingmachine/gotenberg:6
    networks: [ internal ]
    restart: on-failure

# ...
An example setup which includes Gotenberg
version: '3.5'

services:
  gotenberg:
    image: thecodingmachine/gotenberg:6
    networks: [ internal ]
    restart: on-failure

  db:
    image: percona:8.0
    networks: [ internal ]
    environment:
      MYSQL_DATABASE:      ...
      MYSQL_USER:          ...
      MYSQL_PASSWORD:      ...
      MYSQL_ROOT_PASSWORD: ...
    restart: on-failure

  server:
    image: cortezaproject/corteza:${VERSION}
    env_file: [ .env ]
    depends_on: [ db ]
    networks: [ party, internal ]
    environment:
      VIRTUAL_HOST:     ${DOMAIN}
      LETSENCRYPT_HOST: ${DOMAIN}
    restart: on-failure

networks: { internal: {}, party: { name: party } }

Configure Corteza server

Add the following two variables to the .env file:

TEMPLATE_RENDERER_GOTENBERG_ADDRESS=http://gotenberg:3000
TEMPLATE_RENDERER_GOTENBERG_ENABLED=true

Reload the configuration

Reload the configuration with the docker-compose up -d command.