# Export dataframe to pdf file

**URL:** <https://discuss.streamlit.io/t/export-dataframe-to-pdf-file/9777>\
**Category:** Using Streamlit\
**Tags:** file-download, windows\
**Created:** [February 12, 2021, 7:56am UTC](https://discuss.streamlit.io/t/export-dataframe-to-pdf-file/9777 "2021-02-12T07:56:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abbmimn](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/abbmimn/32/5797_2.png) [@abbmimn](https://discuss.streamlit.io/u/abbmimn)\
**Post date:** [February 12, 2021, 7:56am UTC](https://discuss.streamlit.io/t/export-dataframe-to-pdf-file/9777/1 "2021-02-12T07:56:34Z")

</div>

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)

```

![image](https://global.discourse-cdn.com/streamlit/original/2X/f/fb0897a8402d562b0f56c9ae44ba9e5a848d46d0.png)

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [May 13, 2022, 8:43pm UTC](https://discuss.streamlit.io/t/export-dataframe-to-pdf-file/9777/2 "2022-05-13T20:43:25Z")

</div>


