79594091

Date: 2025-04-26 15:29:36
Score: 1
Natty:
Report link

from reportlab.lib.pagesizes import A4

from reportlab.pdfgen import canvas

from reportlab.lib.units import mm

# Define the size of A4

width, height = A4

# Define margins for spiral binding

spiral_margin_left = 20 * mm # extra margin on the left (about 20mm)

spiral_margin_top = 20 * mm # extra margin on the top (about 20mm)

normal_margin = 10 * mm # normal margins for right and bottom

# Outer rectangle coordinates

outer_x = spiral_margin_left

outer_y = normal_margin

outer_width = width - spiral_margin_left - normal_margin

outer_height = height - spiral_margin_top - normal_margin

# Create the PDF

file_path_spiral_single = 'a4_single_line_border_spiral.pdf'

c = canvas.Canvas(file_path_spiral_single, pagesize=A4)

# Draw outer rectangle (single line)

c.setLineWidth(2)

c.rect(outer_x, outer_y, outer_width, outer_height)

# Save the PDF

c.save()

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Bontha Paparao