This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Util .py | |
from io import BytesIO | |
from django.http import HttpResponse | |
from django.template.loader import get_template | |
from xhtml2pdf import pisa | |
def render_to_pdf(template_src, context_dict={}): | |
template = get_template(template_src) | |
html = template.render(context_dict) | |
result = BytesIO() |