Skip to main content

Generate PDF, MS Word and Excel documents from templates in Django.

Project description


.. image::

.. image::

.. image::
:alt: Documentation Status

.. image::
:alt: Dependencies

Generate templated documents within Django in any format supported by
LibreOffice: texts, spreadsheets, presentations etc.

* Free software: MIT license
* Documentation:


* Python 2.7 or 3.4+
* Django >= 1.8
* A recent LibreOffice version (>=4.3.0) supporting LibreOfficeKit API.

.. include:: docs/partial/libffi-warning.rst

Example usage

Create a ``sample.odt`` document (make sure it's in OpenDocument format) and
put it in your Django templates folder. It should look something like this:

.. image::

Then write a view to generate documents from this template:

.. code-block:: python

from templated_docs import fill_template
from templated_docs.http import FileResponse

def get_document(request):
A view to get a document filled with context variables.
context = {'user': request.user} # Just an example

filename = fill_template('sample.odt', context, output_format='pdf')
visible_filename = 'greeting.pdf'

return FileResponse(filename, visible_filename)

Navigate to the url your view is connected to, and you'll see a rendered and converted document:

.. image::

For more examples, see the ``examples/`` subfolder in the repository. More detailed documentation is available on


Templated-docs was written by `Alex Morozov`_.

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter:
.. _`audreyr/cookiecutter-pypackage`:
.. _pylokit:
.. _`Alex Morozov`:

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

templated_docs-0.3.1.tar.gz (45.7 kB view hashes)

Uploaded source

Built Distribution

templated_docs-0.3.1-py2.py3-none-any.whl (18.4 kB view hashes)

Uploaded py2 py3

Supported by

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