Downloading pdf from email send from anvil app weird extension

Hi guys i have a problem. On short, i made an app who makes some analysis on excel files and then you send it to someone. The problem: when i download the file from the email client i get a file without extension. Or extension “File”. Why? Before the sending on email the file is downloaded on the computer and there’s all good. The email file is the problem. If i open on gmail browser directly it works but if i download on the computer is the problem with extension. I have adobe reader and other apps no problem here.

Untitled

Code for the pdf

  settings_pdf_form = anvil.pdf.PDFRenderer(filename=f"{company_name} - {luna}") # , quality="original" asta e bun in caz ca ai ceva dereglari
  pdf = settings_pdf_form.render_form('PDF_render_2', list_of_results, company_name, luna, 
                  company_info_for_render["cui"],
                  company_info_for_render["trezorerie"],
                  company_info_for_render["buget_stat"],
                  company_info_for_render["cont_cam_rc_436"],
                  company_info_for_render["cont_cam_construc_rc_436"],
                  company_info_for_render["tva"],
                  CLIENT_INTELLIX_NAME,
                  email_client,
                  check_box_active_or_not_TRIMESTRU,
                  check_box_ANALIZA_CHART,
                  visible_buttons_panel=False)

If you can help me…thanks a lot!

What code are you using to name the file, between the time it is produced, and the time it is downloaded?

See Constructing Media Objects for how to give these files a usable name and media type.

2 Likes

Yes…at filename i needed to specify the file extension, like file.pdf i just wrote the file name without extension. Thanks mate! Have a nice day!

2 Likes