I want to export dashboard to pdf file but I don’t know how to do it.
How to export dataframe to pdf file?
, please help
This is my code :
> def top_five_ciff():
> sql = """ select * from Table
> """
> cur.execute(sql)
> data = cur.fetchall()
> return data
>
> result = top_five_ciff()
> clean_db = pd.DataFrame(result,columns=["A","B","C","D","E"])
> st.table(clean_db)
>
> def create_download_link(val, filename):
> b64 = base64.b64encode(val)
> return f ' < a href="data:application/octet-stream;base64,{b64.decode()}" download="{filename}.pdf">Download file</a> '
>
> pdf = FPDF()
> pdf.add_page()
> #find function to export dashboard as pdf <<<< This line I don't know how to do it
>
> download_link = st.table(clean_db)
> html = create_download_link(pdf.output(dest="S").encode("UTF-8"), "my_file")
> download_link.markdown(html, unsafe_allow_html=True)