Closed Odrec closed 4 months ago
Hi @Odrec, which version of streamlit-pdf-viewer are you using in your application?
If you call the pdf-viewer with the additional optionrendering=legacy_iframe
could you see the PDF document?
Hi @lfoppiano
The version I'm using is the latest:
streamlit-pdf-viewer==0.0.6.
I tried using that option you suggested but I get the same error. I managed to display the pdf like this with no issue:
binary_data = pdf_file.getvalue()
base64_pdf = base64.b64encode(binary_data).decode('utf-8')
# Embed PDF in HTML
pdf_display = (F'<iframe src="data:application/pdf;base64,{base64_pdf}" '
F'width="100%" height="1000" type="application/pdf"></iframe>')
# Display file
st.markdown(pdf_display, unsafe_allow_html=True)
I think I found one problem, but the error message I received is different from yours. Could you update to version 0.0.7 and let me know if your code works?
I think I found one problem, but the error message I received is different from yours. Could you update to version 0.0.7 and let me know if your code works?
It works now with the latest version :)
I'm going to close this issue. Feel free to reopen or comment, if needed.
I'm getting this error on my browser when trying to display a pdf (any)
This is my code:
I tried one of the PDFs on the app here and the display works fine so it's not the PDF.
I'm using: python==3.12 streamlit==1.31.0