Embed and iframe PDF not showing when deployed to Cloud

Hello all

I’ve an app currently that is looking to display the PDFs in either an iframe or embedded on the page based on user selection.
The PDFs are currently stored in AWS S3.

When I run the app locally, all seems fine. But when I deployed the app to Streamlit Cloud, it just doesnt work out.

Are there anyone that managed to workaround similar issue?

I am not good with frontend dev, thus using streamlit to stretch its capabilities in some app I’m trying to build, but seemed like I had hit a constraint and might need to otherwise do in another framework :frowning:

Welcome to the community!
Any error messages?
Can you please share your public github repo link, otherwise we can only guess…


The above are the links to my repo and the public shared app.

There is no error though, just that the iframe remains blank.
I am currently using Safari browser.

Tried using both and

I’ve not yet tried deploying on EC2 and if it’s an issue that’s with the hosting on Streamlit cloud, or I should approach the PDF display in another method…

No, this method works on streamlit cloud, i used it also before.
Have you checked on streamlit cloud, that pdf_display contains (the proper) content?
Add some debug code.

Here is the code snippet i used:

pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="100%" height="1000px" type="application/pdf"></iframe>'
st.markdown(pdf_display, unsafe_allow_html=True)