Properly scale all elements when ticket size changes

This commit is contained in:
2026-01-05 16:06:11 +01:00
parent 64aa6b82ff
commit 94bbbdb2c0

View File

@@ -83,17 +83,20 @@ if __name__ == "__main__":
current_x = args.margin+(ticket_width+args.gap)*x
current_y = args.margin+(ticket_height+args.gap/1.2)*y
renderPDF.draw(logo, pdf, current_x, current_y+ticket_height*0.40)
drawing = Drawing(ticket_height, ticket_height, transform=[qr_code_size/code_width, 0, 0, qr_code_size/code_height, 0, 0])
drawing.add(qr_code)
renderPDF.draw(logo, pdf, current_x, current_y+35)
renderPDF.draw(drawing, pdf, current_x+logo_width, current_y+ticket_height*0.15)
pdf.setFont("Helvetica", 12)
pdf.drawRightString(current_x+logo_width, current_y+16, "Hier anmelden →")
font_scale = ticket_height/100
pdf.setFont("Helvetica", 8)
pdf.drawRightString(current_x+logo_width+qr_code_size-7, current_y, url)
pdf.setFont("Helvetica", 12*font_scale)
pdf.drawRightString(current_x+logo_width, current_y+ticket_height*0.25, "Hier anmelden →")
pdf.setFont("Helvetica", 8*font_scale)
pdf.drawRightString(current_x+logo_width+qr_code_size-7*font_scale, current_y+ticket_height*0.10, url)
renderPDF.draw(drawing, pdf, current_x+logo_width, current_y+5)
generated_codes += 1
if generated_codes >= args.number:
pdf.save()