Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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(
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
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)
|