Отображение изображения на моем pdf, создаваемом с помощью render_to_pdf
Я хотел бы отобразить изображение на моем pdf, которое я сгенерировал из информации
views.py
class GeneratePdf(View):
    def get(self, request, *args, **kwargs):
       data={'name':'toto','age':122,'service':'smapa'}
       pdf = render_to_pdf('cart/commande.html',data)
       return HttpResponse(pdf, content_type='application/pdf')
utils.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()
  pdf = pisa.pisaDocument(BytesIO(html.encode("UTF-8")), result)
  if not pdf.err:
     return result.getvalue()
  return None
commande.html
{% load static %}
""
<body>
    <div class='wrapper'>
        <div class='header'>
            <p class='title'>Invoice # </p>
            <img src="{% static 'images/tof.png' %}" style="width:100px;height: 100px;">
        </div>
    <div>
    <div class='details'>
        name: {{name}}<br/>
        age: {{age}} <br/>
        service: {{service}}
        <hr class='hrItem' />
    </div>
</div>
</body>
""
Я не могу отобразить изображение, на уровне документа pdf оно упоминается, на уровне консоли выполнения
Need a valid file name
Мне удалось отобразить изображение в pdf, сделав:
commande.html
<img src="static/images/tof.png" style="width:100px;height: 100px;">
Merci