[Fixed]-Rendering PDF documents in bulk in Django

1👍

I’ve used reportlab in a django app (albeit years ago) and it did a great job rendering templated HTML into PDF for download.

Single documents

If this takes less than a couple of seconds, probably fine as part of the request/response cycle.

Bulk zipped documents

To avoid tying up your web workers on long running tasks, you’d typically pushed this kind of heftier work into an async task queue, then provide the user with a link once their download is ready and waiting in storage. That said, it depends on your use case. If you’re sure you’ll only have a few concurrent users, you could potentially justify skipping the additional complexity of the queue. If you’re not sure, it’s probably worth biting the bullet and setting up a queue.

Good news is, if you go the queue route you’ll likely find additional use cases for it pretty quickly. 🙂 For django, celery with redis is a solid combo.

Leave a comment