PDF response is corrupted in Python 3 but works in Python 2
问题 I wrote a working application in python2.7 and Flask. One of the things it does is download a PDF invoice. It's working fine. Now I am doing a new app that also allows downloading a PDF invoice, but I am using Python3 this time. I can save the file to the server and get a perfectly working PDF, but if I try to send it to the browser, the resulting file is corrupted. Here is the download function: @mod.route('/get_invoice/<invoice_id>') def get_invoice(invoice_id): invoice = Invoices.query