You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromflaskimportmake_responsedefresponse_pdf(pdf: FPDF, name: str, title: str=None):
""" recibe un pdf, le asigna un nombre y un titulo y se prepara para enviar. :param pdf: objeto FPDF. :param name: nombre del archivo al descargar. :param title: titulo del archivo. :return: """title=nameiftitleisNoneelsetitlepdf.set_title(title)
response=make_response(pdf.output())
response.headers["Content-Type"] ="application/pdf"response.headers.set('Content-Disposition', f"inline; filename={name}.pdf")
returnresponse
make wrapper to return pdf from endpoint with flask
The text was updated successfully, but these errors were encountered: