6👍
✅
There are several options out there:
- reportlab (suggested by django docs)
- PDFMiner (or +slate wrapper)
- pdfrw
- xhtml2pdf
- pyfpdf (no changes since august, 2012)
- pyPdf (not maintained)
Also take a look at:
- Python PDF library
- Outputting PDFs with Django
- Open Source PDF Libraries in Python
- Generating PDFs with Django
- Django, ReportLab PDF Generation attached to an email
- A Simple Step-by-Step Reportlab Tutorial
- Django output pdf using reportlab
Hope that helps.
2👍
I have been using django-webodt for a few days now to convert OpenOffice template (.odt) dynamically into PDF filling placeholders with database models.
test.odt could be…
Hello {{ first_name }}
import webodt
template = webodt.ODFTemplate('test.odt')
context = dict(first_name="Mary")
document = template.render(Context(context))
from webodt.converters import converter
conv = converter()
pdf = conv.convert(document, format='pdf')
👤Leo
- [Django]-Django – multiplication and templates
- [Django]-Set image size limit and resize image if is needed
- [Django]-How painful is a django project deployment to a live (staging) site?
1👍
Download and try this. The author wrote this:
PyText2Pdf makes a 7-bit clean PDF file from any input file.
It reads from a named file, and writes the PDF file to a file
specified by the user, otherwise to a file with ‘.pdf’ appended to the
input file.
You could run it as stated below:
text2pdf.py rfc_3917.txt -S "Netflow RFC" -A "Quittek, et al." -K netflow,rfc,networking,ipfix -R "[Page\s+\d+]"
But check inside the script for more details.
A link to its usage in Django is here but partly outdated because the older script was used. The link I provided here is the newer one.
- [Django]-Django workflow to convert model superclass to subclass
- [Django]-Django Rest Framework view returns an empty object
- [Django]-How to stop server ran in Daemon mode in Django?
- [Django]-Django rest framework ModelSerializer runs too slowly
Source:stackexchange.com