Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -17,9 +17,11 @@ import logging
|
|
| 17 |
import traceback
|
| 18 |
from video_gen import create_video
|
| 19 |
import zipfile
|
| 20 |
-
from
|
| 21 |
-
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
# Initialize Flask app and CORS
|
| 24 |
app = Flask(__name__)
|
| 25 |
CORS(app)
|
|
@@ -680,13 +682,11 @@ def download_story_archive(story_id):
|
|
| 680 |
blob = bucket.blob(blob_path)
|
| 681 |
image_data = blob.download_as_bytes()
|
| 682 |
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
with open(temp_img_path, "wb") as f:
|
| 686 |
-
f.write(image_data)
|
| 687 |
|
| 688 |
# Insert the image at (x=10, y=None => next line), width=100
|
| 689 |
-
pdf.image(
|
| 690 |
# Clean up temp file
|
| 691 |
os.remove(temp_img_path)
|
| 692 |
|
|
|
|
| 17 |
import traceback
|
| 18 |
from video_gen import create_video
|
| 19 |
import zipfile
|
| 20 |
+
from fpdf2 import FPDF
|
|
|
|
| 21 |
|
| 22 |
+
pdf = FPDF(auto_page_break=True, margin=15)
|
| 23 |
+
pdf.add_page()
|
| 24 |
+
pdf.set_font("Arial", size=12)
|
| 25 |
# Initialize Flask app and CORS
|
| 26 |
app = Flask(__name__)
|
| 27 |
CORS(app)
|
|
|
|
| 682 |
blob = bucket.blob(blob_path)
|
| 683 |
image_data = blob.download_as_bytes()
|
| 684 |
|
| 685 |
+
image_stream = io.BytesIO(image_data)
|
| 686 |
+
|
|
|
|
|
|
|
| 687 |
|
| 688 |
# Insert the image at (x=10, y=None => next line), width=100
|
| 689 |
+
pdf.image(image_stream, x=10, y=None, w=100)
|
| 690 |
# Clean up temp file
|
| 691 |
os.remove(temp_img_path)
|
| 692 |
|