New to Kestra?
Use blueprints to kickstart your first workflows.
Render HTML, Markdown, Word, or Excel into PDF files by calling the Gotenberg API from a Kestra flow, with output capture and full orchestration.
id: generate-pdf-with-gotenberg
namespace: company.team
variables:
server: https://demo.gotenberg.dev
template: https://sparksuite.github.io/simple-html-invoice-template/
tasks:
- id: pdf
type: io.kestra.plugin.scripts.shell.Commands
taskRunner:
type: io.kestra.plugin.core.runner.Process
outputFiles:
- myfile.pdf
commands:
- curl --request POST '{{ vars.server }}/forms/chromium/convert/url'
--form 'url="{{ vars.template }}"' -o myfile.pdf
Turn HTML, Markdown, Word, or Excel sources into polished PDF documents by orchestrating the Gotenberg conversion API from Kestra. Gotenberg is a stateless, Docker-based service that wraps Chromium and LibreOffice behind a simple HTTP interface, so you get reliable, server-side PDF rendering without bundling a headless browser into your own application. This blueprint shows the smallest possible end-to-end pattern: post a source URL to Gotenberg and capture the rendered PDF as a Kestra output file, ready to store, email, or hand off to downstream tasks.
The flow defines two variables: server, pointing at a Gotenberg instance (the public https://demo.gotenberg.dev demo by default), and template, the URL of the HTML page to render. A single pdf task of type io.kestra.plugin.scripts.shell.Commands runs on the io.kestra.plugin.core.runner.Process task runner. It issues a curl POST to the /forms/chromium/convert/url Gotenberg endpoint, passing the template URL as a form field and writing the response to myfile.pdf. That filename is declared in outputFiles, so Kestra captures the generated PDF in internal storage and exposes it as a downloadable execution output.
myfile.pdf captured as a Kestra output file on every run.Gotenberg is a conversion service, not a scheduler: it renders what you send it and nothing more. Kestra supplies the orchestration layer around it. You can drive conversions from schedule or event triggers, add automatic retries when the API is briefly unavailable, fan out across many documents, and chain the PDF into downstream tasks such as uploading to object storage or sending an email. Every run is captured with full lineage and logs, and the whole pipeline stays declarative YAML you can version and review.
docker run --rm -p 3000:3000 gotenberg/gotenberg:7, then set server to your instance, or keep the bundled https://demo.gotenberg.dev demo for testing.curl available on the worker (it ships with the Process runner environment used here).This blueprint references no Kestra secrets. The default demo endpoint is public; if your Gotenberg instance requires authentication, add a header to the curl command and store the credential with {{ secret('GOTENBERG_TOKEN') }}.
server variable to your Gotenberg URL, or leave the demo default.template to the page you want to convert.myfile.pdf from the execution outputs./forms/libreoffice/convert to turn Word or Excel files into PDFs.pdf task with a storage upload or notification task to deliver the result.