PDF-Output: str/bytes handling fix

This commit is contained in:
Erik Thiele
2026-07-02 17:05:36 +02:00
parent ebc4ca0000
commit c2bd9aae89
3 changed files with 31 additions and 1 deletions

5
app.py
View File

@@ -399,8 +399,11 @@ def invoice_pdf():
pdf.ln(6)
pdf.cell(180, 4, "Zahlbar innerhalb von 14 Tagen ohne Abzug. Vielen Dank fur Ihren Auftrag!")
pdf_out = pdf.output(dest='S')
if isinstance(pdf_out, str):
pdf_out = pdf_out.encode('latin-1')
return send_file(
io.BytesIO(pdf.output(dest='S').encode('latin-1')),
io.BytesIO(pdf_out),
mimetype='application/pdf',
as_attachment=True,
download_name='rechnung.pdf'