Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,6 @@ def generate_report(images, job_number, job_name, job_address, uploader_name, la
|
|
| 32 |
|
| 33 |
# Add logo and job details to header
|
| 34 |
header = section.header
|
| 35 |
-
# Include width parameter when adding table to header
|
| 36 |
header_table = header.add_table(rows=1, cols=2, width=available_width)
|
| 37 |
header_table.alignment = WD_TABLE_ALIGNMENT.CENTER
|
| 38 |
header_table.autofit = False # Disable autofit to use specified widths
|
|
@@ -98,9 +97,10 @@ def generate_report(images, job_number, job_name, job_address, uploader_name, la
|
|
| 98 |
|
| 99 |
# Insert metadata below the image
|
| 100 |
for text in metadata_texts:
|
| 101 |
-
paragraph = cell.add_paragraph(
|
| 102 |
-
|
| 103 |
-
|
|
|
|
| 104 |
paragraph.paragraph_format.line_spacing = Pt(9)
|
| 105 |
paragraph.paragraph_format.space_before = Pt(0)
|
| 106 |
paragraph.paragraph_format.space_after = Pt(0)
|
|
@@ -110,12 +110,13 @@ def generate_report(images, job_number, job_name, job_address, uploader_name, la
|
|
| 110 |
# Start a new section for each page
|
| 111 |
if i > 0:
|
| 112 |
doc.add_section()
|
| 113 |
-
|
| 114 |
# Process up to two images per page
|
| 115 |
for j in range(i, min(i + 2, num_images)):
|
| 116 |
img_file = images[j]
|
| 117 |
# Insert image
|
| 118 |
-
|
|
|
|
| 119 |
run.add_picture(img_file, width=Inches(4.5)) # Adjust width to fit content
|
| 120 |
|
| 121 |
# Retrieve the photo taken date
|
|
@@ -132,9 +133,10 @@ def generate_report(images, job_number, job_name, job_address, uploader_name, la
|
|
| 132 |
|
| 133 |
# Insert metadata below the image
|
| 134 |
for text in metadata_texts:
|
| 135 |
-
paragraph = doc.add_paragraph(
|
| 136 |
-
|
| 137 |
-
|
|
|
|
| 138 |
paragraph.paragraph_format.line_spacing = Pt(9)
|
| 139 |
paragraph.paragraph_format.space_before = Pt(0)
|
| 140 |
paragraph.paragraph_format.space_after = Pt(0)
|
|
|
|
| 32 |
|
| 33 |
# Add logo and job details to header
|
| 34 |
header = section.header
|
|
|
|
| 35 |
header_table = header.add_table(rows=1, cols=2, width=available_width)
|
| 36 |
header_table.alignment = WD_TABLE_ALIGNMENT.CENTER
|
| 37 |
header_table.autofit = False # Disable autofit to use specified widths
|
|
|
|
| 97 |
|
| 98 |
# Insert metadata below the image
|
| 99 |
for text in metadata_texts:
|
| 100 |
+
paragraph = cell.add_paragraph()
|
| 101 |
+
run = paragraph.add_run(text)
|
| 102 |
+
run.font.name = "Arial"
|
| 103 |
+
run.font.size = Pt(9)
|
| 104 |
paragraph.paragraph_format.line_spacing = Pt(9)
|
| 105 |
paragraph.paragraph_format.space_before = Pt(0)
|
| 106 |
paragraph.paragraph_format.space_after = Pt(0)
|
|
|
|
| 110 |
# Start a new section for each page
|
| 111 |
if i > 0:
|
| 112 |
doc.add_section()
|
| 113 |
+
|
| 114 |
# Process up to two images per page
|
| 115 |
for j in range(i, min(i + 2, num_images)):
|
| 116 |
img_file = images[j]
|
| 117 |
# Insert image
|
| 118 |
+
paragraph = doc.add_paragraph()
|
| 119 |
+
run = paragraph.add_run()
|
| 120 |
run.add_picture(img_file, width=Inches(4.5)) # Adjust width to fit content
|
| 121 |
|
| 122 |
# Retrieve the photo taken date
|
|
|
|
| 133 |
|
| 134 |
# Insert metadata below the image
|
| 135 |
for text in metadata_texts:
|
| 136 |
+
paragraph = doc.add_paragraph()
|
| 137 |
+
run = paragraph.add_run(text)
|
| 138 |
+
run.font.name = "Arial"
|
| 139 |
+
run.font.size = Pt(9)
|
| 140 |
paragraph.paragraph_format.line_spacing = Pt(9)
|
| 141 |
paragraph.paragraph_format.space_before = Pt(0)
|
| 142 |
paragraph.paragraph_format.space_after = Pt(0)
|