Add cut marks to margin area
This commit is contained in:
25
generate.py
25
generate.py
@@ -71,6 +71,27 @@ if __name__ == "__main__":
|
|||||||
generated_codes = 0
|
generated_codes = 0
|
||||||
|
|
||||||
for page in range(required_pages):
|
for page in range(required_pages):
|
||||||
|
# Add crop marks in the margin area
|
||||||
|
if args.margin > 4:
|
||||||
|
pdf.setLineWidth(0.01)
|
||||||
|
|
||||||
|
for row in range(codes_per_row):
|
||||||
|
x = args.margin+row*(ticket_width+args.gap)
|
||||||
|
pdf.line(x1=x, y1=1, x2=x, y2=args.margin-3)
|
||||||
|
pdf.line(x1=x, y1=page_height-1, x2=x, y2=page_height-args.margin+3)
|
||||||
|
if args.gap > 0 or row == codes_per_row-1:
|
||||||
|
pdf.line(x1=x+ticket_width, y1=1, x2=x+ticket_width, y2=args.margin-3)
|
||||||
|
pdf.line(x1=x+ticket_width, y1=page_height-1, x2=x+ticket_width, y2=page_height-args.margin+3)
|
||||||
|
|
||||||
|
for col in range(codes_per_col):
|
||||||
|
y = args.margin+col*(ticket_height+args.gap/1.2)
|
||||||
|
pdf.line(x1=1, y1=y, x2=args.margin-3, y2=y)
|
||||||
|
pdf.line(x1=page_width-1, y1=y, x2=page_width-args.margin+3, y2=y)
|
||||||
|
if args.gap > 0 or col == codes_per_col-1:
|
||||||
|
pdf.line(x1=1, y1=y+ticket_height, x2=args.margin-3, y2=y+ticket_height)
|
||||||
|
pdf.line(x1=page_width-1, y1=y+ticket_height, x2=page_width-args.margin+3, y2=y+ticket_height)
|
||||||
|
|
||||||
|
|
||||||
for y in range(codes_per_col):
|
for y in range(codes_per_col):
|
||||||
for x in range(codes_per_row):
|
for x in range(codes_per_row):
|
||||||
url = urljoin(args.url, generate_random_username(female_nouns, male_nouns, adjectives, used_usernames))
|
url = urljoin(args.url, generate_random_username(female_nouns, male_nouns, adjectives, used_usernames))
|
||||||
@@ -83,6 +104,10 @@ if __name__ == "__main__":
|
|||||||
current_x = args.margin+(ticket_width+args.gap)*x
|
current_x = args.margin+(ticket_width+args.gap)*x
|
||||||
current_y = args.margin+(ticket_height+args.gap/1.2)*y
|
current_y = args.margin+(ticket_height+args.gap/1.2)*y
|
||||||
|
|
||||||
|
# Print outline around ticket for debugging
|
||||||
|
# pdf.setLineWidth(0.01)
|
||||||
|
# pdf.rect(current_x, current_y, ticket_width, ticket_height)
|
||||||
|
|
||||||
renderPDF.draw(logo, pdf, current_x, current_y+ticket_height*0.40)
|
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 = Drawing(ticket_height, ticket_height, transform=[qr_code_size/code_width, 0, 0, qr_code_size/code_height, 0, 0])
|
||||||
|
|||||||
Reference in New Issue
Block a user