How to display a pdf content fullsize

how to display pdf content full size. iframe doesnt display it as the whole page

        merged_buffer = io.BytesIO()

        pdf_content =
        pdf_base64 = base64.b64encode(pdf_content).decode('utf-8')

pdf content code looks like this

Hi @Charlieletscode,

You could try and see if this code works for you. Adjust the height and width as required.

import streamlit as st
import base64

def ViewPDF(wch_fl):
    with open(wch_fl,"rb") as pdf_file:
        base64_pdf = base64.b64encode('utf-8')
        pdf_display = f'<embed src="data:application/pdf;base64,{base64_pdf}" width="1000" height="500" type="application/pdf">' 
        st.markdown(pdf_display, unsafe_allow_html=True)

ViewPDF("./tst.pdf")    # provide file path + full file name


yeah but it still doesn fulfill fullscreen. I believe that there is no such function. answer could be open not restrict to streamlit

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.