Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -616,7 +616,7 @@ def view_videos():
|
|
| 616 |
|
| 617 |
#download archives endpoint
|
| 618 |
|
| 619 |
-
# Configure
|
| 620 |
|
| 621 |
@app.route('/api/download/story_archive/<story_id>', methods=['GET'])
|
| 622 |
def download_story_archive(story_id):
|
|
@@ -662,11 +662,14 @@ def download_story_archive(story_id):
|
|
| 662 |
pdf.add_page()
|
| 663 |
pdf.set_font("Arial", size=12)
|
| 664 |
|
| 665 |
-
|
| 666 |
-
|
|
|
|
|
|
|
|
|
|
| 667 |
pdf.ln(10)
|
| 668 |
-
pdf.multi_cell(
|
| 669 |
-
pdf.multi_cell(
|
| 670 |
|
| 671 |
# Add sections
|
| 672 |
bucket = storage.bucket()
|
|
@@ -676,9 +679,9 @@ def download_story_archive(story_id):
|
|
| 676 |
|
| 677 |
pdf.add_page()
|
| 678 |
pdf.set_font("Arial", style='B', size=14)
|
| 679 |
-
pdf.multi_cell(
|
| 680 |
pdf.set_font("Arial", size=12)
|
| 681 |
-
pdf.multi_cell(
|
| 682 |
|
| 683 |
# Download & embed images
|
| 684 |
if image_url:
|
|
|
|
| 616 |
|
| 617 |
#download archives endpoint
|
| 618 |
|
| 619 |
+
# Configure lo)s")
|
| 620 |
|
| 621 |
@app.route('/api/download/story_archive/<story_id>', methods=['GET'])
|
| 622 |
def download_story_archive(story_id):
|
|
|
|
| 662 |
pdf.add_page()
|
| 663 |
pdf.set_font("Arial", size=12)
|
| 664 |
|
| 665 |
+
# Ensure text fits the page width properly
|
| 666 |
+
max_width = 190 # Keep within A4 width
|
| 667 |
+
|
| 668 |
+
pdf.multi_cell(max_width, 10, f"Story ID: {story_id}")
|
| 669 |
+
pdf.multi_cell(max_width, 10, f"Title: {title}")
|
| 670 |
pdf.ln(10)
|
| 671 |
+
pdf.multi_cell(max_width, 10, "Full Story:")
|
| 672 |
+
pdf.multi_cell(max_width, 10, full_text)
|
| 673 |
|
| 674 |
# Add sections
|
| 675 |
bucket = storage.bucket()
|
|
|
|
| 679 |
|
| 680 |
pdf.add_page()
|
| 681 |
pdf.set_font("Arial", style='B', size=14)
|
| 682 |
+
pdf.multi_cell(max_width, 10, f"Section {idx + 1}")
|
| 683 |
pdf.set_font("Arial", size=12)
|
| 684 |
+
pdf.multi_cell(max_width, 10, section_text)
|
| 685 |
|
| 686 |
# Download & embed images
|
| 687 |
if image_url:
|