# Showing PDF file on StreamlitSharing that's in github directory

**URL:** <https://discuss.streamlit.io/t/showing-pdf-file-on-streamlitsharing-thats-in-github-directory/11955>\
**Category:** Community Cloud\
**Created:** [April 16, 2021, 10:00am UTC](https://discuss.streamlit.io/t/showing-pdf-file-on-streamlitsharing-thats-in-github-directory/11955 "2021-04-16T10:00:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wlpretorius](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/wlpretorius/32/6829_2.png) [@wlpretorius](https://discuss.streamlit.io/u/wlpretorius)\
**Post date:** [April 16, 2021, 10:00am UTC](https://discuss.streamlit.io/t/showing-pdf-file-on-streamlitsharing-thats-in-github-directory/11955/1 "2021-04-16T10:00:43Z")

</div>

Hi, i am building an app that does timeseries forecasting and would like to show a pdf instruction file on my about section. The problem is, it isnt showing in streamlit sharing but it is showing when i run it in browser locally. Here is examples and the code i used.

Locally:

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

Sharing:

 ![image](https://global.discourse-cdn.com/streamlit/original/2X/0/099790b2cef0f3a6b2b1b1df67b410a57e9bd3a6.png)  
 ![image](https://global.discourse-cdn.com/streamlit/original/2X/1/11d0bc41ea7755e813ce4e1585563785058e26bc.png)

Code:

```auto
    if st.checkbox("Show Instructions"):
        def show_pdf(file_path):
            with open(file_path,"rb") as f:
                  base64_pdf = base64.b64encode(f.read()).decode('utf-8')
            pdf_display = f'<embed src="data:application/pdf;base64,{base64_pdf}" width="700" height="1000" type="application/pdf">'
            st.markdown(pdf_display, unsafe_allow_html=True)
        st.write(show_pdf("DFCU_Instructions_on_GUI.pdf"))

```

Possible anyone can tell me why it is showing None? and How i can fix this or have any other method to showcase an instruction pdf file in streamlit sharing, or maybe a download link where they can download the file that is on my public github?

---

<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:** [April 16, 2021, 4:27pm UTC](https://discuss.streamlit.io/t/showing-pdf-file-on-streamlitsharing-thats-in-github-directory/11955/2 "2021-04-16T16:27:29Z")

</div>

My guess would be that Streamlit starts in a different directory on sharing than you are locally. Meaning, you relative file reference in `show_pdf` doesn’t exist, so Python shows `None`

Perhaps you could try using [pathlib](https://docs.python.org/3/library/pathlib.html) to programmatically determine where you file actually is?

Best,  
Randy

---

<div class="post-metadata">

**Author:** ![Spidy20](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/spidy20/32/8627_2.png) [@Spidy20](https://discuss.streamlit.io/u/Spidy20)\
**Post date:** [August 10, 2021, 3:07am UTC](https://discuss.streamlit.io/t/showing-pdf-file-on-streamlitsharing-thats-in-github-directory/11955/3 "2021-08-10T03:07:55Z")

</div>

I got the solution for this, this is returning none just because we are using st.write. After displays pdf it becomes none. Now the solution is to remove that st.write, and just do a function call like this.

```auto
    pdf_file = st.file_uploader("Choose your Resume", type=["pdf"])
    if pdf_file is not None:
        save_image_path = './Uploaded_Resumes/'+pdf_file.name
        with open(save_image_path, "wb") as f:
            f.write(pdf_file.getbuffer())
        show_pdf(save_image_path)

```
