Update utils.py
Browse files
utils.py
CHANGED
|
@@ -47,23 +47,27 @@ def generate_pdf(df_combined, company_name, address, unit):
|
|
| 47 |
# Create a canvas for the PDF
|
| 48 |
c = canvas.Canvas(buffer, pagesize=letter)
|
| 49 |
width, height = letter
|
| 50 |
-
|
|
|
|
| 51 |
# Company details
|
| 52 |
c.setFont("Helvetica", 12)
|
| 53 |
-
c.drawString(30,
|
| 54 |
-
|
|
|
|
| 55 |
|
| 56 |
# Draw a line under the address
|
|
|
|
| 57 |
c.setStrokeColor(colors.black)
|
| 58 |
c.setLineWidth(1)
|
| 59 |
-
c.line(30,
|
| 60 |
|
| 61 |
# Title
|
|
|
|
| 62 |
c.setFont("Helvetica-Bold", 16)
|
| 63 |
-
c.drawString(30,
|
| 64 |
|
| 65 |
# Calculate the y-position to avoid overlapping
|
| 66 |
-
y_position =
|
| 67 |
|
| 68 |
# Create and style the table
|
| 69 |
data = [["Sl no", "Type", "Outer Frame", "Shutter", "Glass", "Area"]] # Table Header
|
|
|
|
| 47 |
# Create a canvas for the PDF
|
| 48 |
c = canvas.Canvas(buffer, pagesize=letter)
|
| 49 |
width, height = letter
|
| 50 |
+
|
| 51 |
+
y_position = height - 40
|
| 52 |
# Company details
|
| 53 |
c.setFont("Helvetica", 12)
|
| 54 |
+
c.drawString(30, y_position, f"Company Name: {company_name}")
|
| 55 |
+
y_position -= 20
|
| 56 |
+
c.drawString(30, y_position, f"Address: {address}")
|
| 57 |
|
| 58 |
# Draw a line under the address
|
| 59 |
+
y_position -= 10
|
| 60 |
c.setStrokeColor(colors.black)
|
| 61 |
c.setLineWidth(1)
|
| 62 |
+
c.line(30, y_position, width - 30, y_position) # Draw line under the address
|
| 63 |
|
| 64 |
# Title
|
| 65 |
+
y_position -= 30
|
| 66 |
c.setFont("Helvetica-Bold", 16)
|
| 67 |
+
c.drawString(30, y_position, f"Dimensions Calculation Results: for units ({unit})")
|
| 68 |
|
| 69 |
# Calculate the y-position to avoid overlapping
|
| 70 |
+
y_position -= 20
|
| 71 |
|
| 72 |
# Create and style the table
|
| 73 |
data = [["Sl no", "Type", "Outer Frame", "Shutter", "Glass", "Area"]] # Table Header
|