NameError: name 'base64' is not defined

def show_pdf(file_path):
with open(file_path,“rb”) as f:
base64_pdf = base64.b64encode(f.read()).decode(‘utf-8’)
pdf_display = f’’
st.markdown(pdf_display, unsafe_allow_html=True)

show_pdf(r’C:\Aravindh\Desktop\books\big.2013.1508.pdf’)

Hi @Aravindh_P, welcome to the community! :wave: :partying_face:

Have you imported base64? This error is usually indicative of the use of a package that hasn’t been imported.

Best, :balloon:
Snehan

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