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.1.0.tar.gz (3.8 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.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_gotenberg-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 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.1.0.tar.gz
Algorithm Hash digest
SHA256 e7396e44587ab072871ea6e6ea79100cd9be730ecc47e0b86dd9afae1ff3865e
MD5 f41b835b2a26e3827b9bd95b72cef8e5
BLAKE2b-256 14861299707922333a74e629c7455f48456fb85522d5e8b3fd261747112050df

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gotenberg-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_gotenberg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17a97c2470edb2d6e1818ebb4265524923a7ea759e48aa4394b585e5356eee3b
MD5 2745f212203078d50cf2c2c670a446d6
BLAKE2b-256 c5ecd55abba6d03454acd7ad6e1406d21d5443708cfa9e74b8e0f2ae9c1ca564

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gotenberg-0.1.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