Skip to main content

Render any Django template to a PDF using Gotenberg

Project description

Django Gotenberg is a Django app that provides a render_to_pdf function to render Django templates to PDF responses using a Gotenberg instance.

Static files referenced via {% static %} tags in the template are resolved and sent to Gotenberg alongside the rendered HTML so that images, stylesheets, and other assets are embedded correctly in the generated PDF.

Quick start

  1. Run a Gotenberg instance:

    docker run --rm -p 3000:3000 gotenberg/gotenberg:8
  2. Add GOTENBERG_HOST to your Django settings:

    GOTENBERG_HOST = 'http://localhost:3000'
  3. Use render_to_pdf in your views:

    from django_gotenberg import render_to_pdf
    
    def my_view(request):
        return render_to_pdf(request, 'my_template.html', {'key': 'value'})
    
    # With a download filename:
    def my_download_view(request):
        return render_to_pdf(request, 'my_template.html', filename='report.pdf')

Configuration

All configuration is done via Django settings:

Setting

Description

Default

GOTENBERG_HOST

URL of the Gotenberg instance (required)

GOTENBERG_TIMEOUT

Request timeout in seconds

30.0

GOTENBERG_USERNAME

HTTP basic auth username

GOTENBERG_PASSWORD

HTTP basic auth password

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_gotenberg-0.2.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_gotenberg-0.2.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file django_gotenberg-0.2.0.tar.gz.

File metadata

  • Download URL: django_gotenberg-0.2.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_gotenberg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0cbe22f780d18694ebc2a6f1c293b3a96fb31549a7601c8ef04a7dde2eba7acd
MD5 6b7195432ed4bca34ee9013bd4c4a12c
BLAKE2b-256 ee8e0d726ea6df1e111e429565d11aa55577a226d6104763b1f3dd2ca0afd6fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gotenberg-0.2.0.tar.gz:

Publisher: python-publish.yml on kuboschek/django-gotenberg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_gotenberg-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_gotenberg-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34e80b64210e4a18a5f25647d9868774b228841501fcc7006089c99f5a3891d7
MD5 0569a1401bc239115ae625cc8a8aafe6
BLAKE2b-256 19f756371394c059917cbb3505cdea67fbe963b3b9a32eabe5ec1bd5c1c890e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gotenberg-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on kuboschek/django-gotenberg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page