Metadata-Version: 2.4
Name: django-gotenberg
Version: 0.2.0
Summary: Render any Django template to a PDF using Gotenberg
Home-page: https://github.com/kuboschek/django-pdf-render
Author: Leonhard Kuboschek
Author-email: leo@jacobs-alumni.de
License: BSD-3-Clause
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Description-Content-Type: text/x-rst
Requires-Dist: Django>=4.2
Requires-Dist: gotenberg-client>=0.7.0

=================
Django Gotenberg
=================

Django Gotenberg is a Django app that provides a ``render_to_pdf`` function to
render Django templates to PDF responses using a `Gotenberg <https://gotenberg.dev>`_ 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                  —
============================== ========================================= ===========
