com3dian commited on
Commit
dbab208
·
verified ·
1 Parent(s): 4efca8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -176,12 +176,16 @@ def create_pdf_from_markdown_strings(markdown_strings):
176
 
177
  return html_pages
178
 
179
- def generate_pdf(html):
180
- # Create a PDF from the HTML string
181
- pdf_file = BytesIO()
182
- HTML(string=html).write_pdf(pdf_file)
183
- pdf_file.seek(0)
184
- return pdf_file
 
 
 
 
185
 
186
  html_content = create_pdf_from_markdown_strings(st.session_state.summ_text)
187
  pdf_file = generate_pdf(html_content)
 
176
 
177
  return html_pages
178
 
179
+ def generate_pdf(html_strings):
180
+ pdf = BytesIO()
181
+ # Convert each HTML string to a PDF page
182
+ pdf_content = b''
183
+ for html_string in html_strings:
184
+ pdf_content += HTML(string=html_string).write_pdf()
185
+
186
+ pdf.write(pdf_content)
187
+ pdf.seek(0)
188
+ return pdf
189
 
190
  html_content = create_pdf_from_markdown_strings(st.session_state.summ_text)
191
  pdf_file = generate_pdf(html_content)