yuanjie commited on
Commit
23c6d6b
·
1 Parent(s): 0153acf
Files changed (1) hide show
  1. pages/2_📚_PDF预览.py +9 -8
pages/2_📚_PDF预览.py CHANGED
@@ -9,14 +9,15 @@ https://zhuanlan.zhihu.com/p/518115802?utm_medium=social&utm_oi=1290068536690085
9
  class MyPage(Page):
10
 
11
  def main(self):
12
- with st.form("PDF"):
13
- file = st.file_uploader("选择待上传的PDF文件", type=['pdf'])
14
-
15
- if st.form_submit_button('开始预览', help='先上传文件!!!'):
16
- if file is not None:
17
- base64_pdf = base64.b64encode(file.read()).decode('utf-8')
18
- pdf_display = f"""<embed src="data:application/pdf;base64,{base64_pdf}" width="100%" height="800" type="application/pdf">"""
19
- st.markdown(pdf_display, unsafe_allow_html=True)
 
20
 
21
 
22
  if __name__ == '__main__':
 
9
  class MyPage(Page):
10
 
11
  def main(self):
12
+ pass
13
+ # with st.form("PDF"):
14
+ # file = st.file_uploader("选择待上传的PDF文件", type=['pdf'])
15
+ #
16
+ # if st.form_submit_button('开始预览', help='先上传文件!!!'):
17
+ # if file is not None:
18
+ # base64_pdf = base64.b64encode(file.read()).decode('utf-8')
19
+ # pdf_display = f"""<embed src="data:application/pdf;base64,{base64_pdf}" width="100%" height="800" type="application/pdf">"""
20
+ # st.markdown(pdf_display, unsafe_allow_html=True)
21
 
22
 
23
  if __name__ == '__main__':