pg_mupdf
pg_mupdf · Convert HTML to PDF inside PostgreSQL using MuPDF
Overview
PostgreSQL · 9.4, 9.5, 9.6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
Usage
Sources:
pg_mupdf converts HTML into PDF inside the PostgreSQL backend. Upstream tested PostgreSQL 9.4 through 19 and requires MuPDF 1.24 or later.
Basic use
The function returns bytea. Read the bytes through a database client to save the file. Upgrade an existing 1.0 installation with ALTER EXTENSION pg_mupdf UPDATE. Version 2.0 accepts both text and bytea. Text is converted to UTF-8 in databases with a declared encoding. Binary input preserves the original bytes.
Runtime behavior
Superusers can limit input parsers with pg_mupdf.document_handlers, which defaults to html,xhtml. The per-call pg_mupdf.memory_limit defaults to 1GB. Setting it to 0 removes the limit. Both overloads grant execution to PUBLIC by default.