Gotenberg Client

raw JSON →
0.14.0 verified Fri May 01 auth: no python

A Python client for interfacing with the Gotenberg API. Current version 0.14.0, requires Python >=3.10. Actively maintained with regular releases.

pip install gotenberg-client
error ModuleNotFoundError: No module named 'gotenberg_client.options'
cause Constants and options were moved from gotenberg_client.options to gotenberg_client.constants in v0.13.0.
fix
Use 'from gotenberg_client.constants import ...' instead.
error AttributeError: module 'gotenberg_client' has no attribute 'PdfRoute'
cause Likely using an older version or incorrect import. PdfRoute is available from the top-level module.
fix
Use 'from gotenberg_client import PdfRoute'.
breaking Drop support for Python 3.9 in v0.14.0. Upgrade to Python >=3.10.
fix Use Python 3.10 or higher.
breaking Drop support for Python 3.8 in v0.8.0.
fix Use Python 3.9 or higher (but note further changes).
deprecated Incorrect import path for constants: moved from gotenberg_client.options to gotenberg_client.constants in v0.13.0.
fix Use from gotenberg_client.constants import ... instead of from gotenberg_client.options.
gotcha The async client uses httpx.AsyncClient; ensure you use await with async methods.
fix Properly await async methods and use async context managers.

Quickstart: Convert HTML to PDF using a local Gotenberg instance.

from gotenberg_client import GotenbergClient

client = GotenbergClient('http://localhost:3000')
with client:
    pdf = client.pdf.convert_html('<html><body><p>Hello, World!</p></body></html>', filename='test.html')
    with open('output.pdf', 'wb') as f:
        f.write(pdf)