@Loubna_Massaoudi I think you’d be best off saving the table as XLSX and then Popen’ing a (PowerShell) script to convert that to PDF (see this). Afterwards opening it as base64 encoded and then show a download URL as described in this discussion thread. Presumably this approach will be limited to Windows with Excel installed, so may not work for you.
I had a quick look at PyFPDF package and there are code template examples that might be useful too. PDFs are rendered a bit like bitmaps so quite complex to handle.
The simplest workaround is to use the browser’s print-and-save-as-PDF option if the client computer has Acrobat or Foxit PDF reader installed.
I’ve seen you duplicated your question elsewhere, but have you seen this post which will help with saving as Excel and providing a download link to that file (not PDF though).?