Sina Media Lab commited on
Commit
f0f573f
Β·
1 Parent(s): a58f65d
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -148,7 +148,7 @@ if selected_category:
148
  selected_module_data = module_data
149
  break
150
 
151
- # Display black background title with PDF report icon, but only show the icon when at least one question is answered
152
  st.markdown(
153
  f"""
154
  <div style="background-color: #333; padding: 10px; border-radius: 5px; margin-top: 20px;">
@@ -159,12 +159,9 @@ if selected_category:
159
  )
160
 
161
  if len(st.session_state.questions) > 0:
162
- st.markdown(
163
- f"""
164
- <a href='#' download='quiz_report.pdf' style='font-size: 18px; margin-left: 10px; color: white;' onclick='document.getElementById("pdf-link").click();'>πŸ“„ Download PDF Report</a>
165
- """,
166
- unsafe_allow_html=True
167
- )
168
 
169
  if selected_module != st.session_state.current_module:
170
  st.session_state.current_module = selected_module
 
148
  selected_module_data = module_data
149
  break
150
 
151
+ # Display black background title with PDF report button, but only show the button when at least one question is answered
152
  st.markdown(
153
  f"""
154
  <div style="background-color: #333; padding: 10px; border-radius: 5px; margin-top: 20px;">
 
159
  )
160
 
161
  if len(st.session_state.questions) > 0:
162
+ if st.button("πŸ“„ Download PDF Report"):
163
+ pdf_data = generate_pdf_report()
164
+ st.download_button(label="Click to download", data=pdf_data, file_name="quiz_report.pdf", mime="application/pdf")
 
 
 
165
 
166
  if selected_module != st.session_state.current_module:
167
  st.session_state.current_module = selected_module