We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I generate the pdf with images, in the generated PDF only a white image with a border instead of the original image appears
VIEWS.PY context = {} attach = Attachment() soup = BeautifulSoup(description) descriptions = soup.findAll('p') for d in descriptions: token = str(d)[3:-4] if token[:9] == '<img src=': format, imgstr = token.split(';base64,') ext = format.split('/')[-1] data = ContentFile(base64.b64decode(imgstr), name='temp.' + ext) attach.attach = data attach.save() dd.append(attach.attach) context['dd'] = dd filename = fill_template('invoice/invoice2.odt', context, output_format='pdf') visible_filename = 'invoice.{}'.format('pdf') return FileResponse(filename, visible_filename)
INVOICE2.ODT {% load templated_docs_tags %} {% for d in dd %} {% image d %} {% endfor %}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
When I generate the pdf with images, in the generated PDF only a white image with a border instead of the original image appears
What I Did
VIEWS.PY
context = {}
attach = Attachment()
soup = BeautifulSoup(description)
descriptions = soup.findAll('p')
for d in descriptions:
token = str(d)[3:-4]
if token[:9] == '<img src=':
format, imgstr = token.split(';base64,')
ext = format.split('/')[-1]
data = ContentFile(base64.b64decode(imgstr), name='temp.' + ext)
attach.attach = data
attach.save()
dd.append(attach.attach)
context['dd'] = dd
filename = fill_template('invoice/invoice2.odt', context, output_format='pdf')
visible_filename = 'invoice.{}'.format('pdf')
return FileResponse(filename, visible_filename)
INVOICE2.ODT
{% load templated_docs_tags %}
{% for d in dd %}
{% image d %}
{% endfor %}
The text was updated successfully, but these errors were encountered: