Option for get_invoice_as_pdf to return the PDF as bytes
Hi, it would be really useful for us if accounting_api.get_invoice_as_pdf could return the PDF as bytes, instead of saving the file to /tmp/. At the moment our code looks roughly like:
filepath = accounting_api.get_invoice_as_pdf(tenant_id, invoice_id=uuid)
with open(filepath, 'rb') as f:
pdf_bytes = f.read()
os.remove(filepath)
return pdf_bytes
And would be nice if we could instead do something like:
return accounting_api.get_invoice_as_pdf(tenant_id, invoice_id=uuid, pdf_as_bytes=True)
To avoid fetching the PDF, saving it to file, reading the file, deleting the file and then returning the bytes.
it would be helpful if i know the location of the file in which this code is written.
It would be also nice if we could instruct the function where to drop the file. Ie:
accounting_api.get_invoice_as_pdf(tenant_id, invoice_id=uuid, filename='/var/www/html/myapp/invoices/inv123.pdf')