printable_offset_y = printable_margin * A4_HEIGHT / A4_WIDTH
new_page.add_transformation(pypdf.Transformation().scale(printable_scale, printable_scale))
new_page.add_transformation(pypdf.Transformation().translate(tx=printable_offset_x, ty=printable_offset_y))
- x_left_SPINE_LIMIT = half_width * bonus_shrink_factor
- x_right_SPINE_LIMIT = A4_WIDTH - x_left_SPINE_LIMIT
+ x_left_spine_limit = half_width * bonus_shrink_factor
+ x_right_spine_limit = A4_WIDTH - x_left_spine_limit
if args.analyze or front_page:
packet = io.BytesIO()
c = reportlab.pdfgen.canvas.Canvas(packet, pagesize=A4)
if args.analyze:
# spine lines
c.setLineWidth(0.1)
- c.line(x_left_SPINE_LIMIT, A4_HEIGHT, x_left_SPINE_LIMIT, 0)
- c.line(x_right_SPINE_LIMIT, A4_HEIGHT, x_right_SPINE_LIMIT, 0)
+ c.line(x_left_spine_limit, A4_HEIGHT, x_left_spine_limit, 0)
+ c.line(x_right_spine_limit, A4_HEIGHT, x_right_spine_limit, 0)
if front_page:
c.setLineWidth(0.2)
# cut upper left
- start_up_left_left_x = x_left_SPINE_LIMIT - 0.5 * CUT_WIDTH
- start_up_left_right_x = x_left_SPINE_LIMIT + 0.5 * CUT_WIDTH
+ start_up_left_left_x = x_left_spine_limit - 0.5 * CUT_WIDTH
+ start_up_left_right_x = x_left_spine_limit + 0.5 * CUT_WIDTH
middle_point_up_left_y = half_height + MIDDLE_POINT_DEPTH
end_point_up_left_y = half_height + CUT_DEPTH
- c.line(start_up_left_right_x, half_height, x_left_SPINE_LIMIT, end_point_up_left_y)
- c.line(x_left_SPINE_LIMIT, end_point_up_left_y, x_left_SPINE_LIMIT, middle_point_up_left_y)
- c.line(x_left_SPINE_LIMIT, middle_point_up_left_y, start_up_left_left_x, half_height)
+ c.line(start_up_left_right_x, half_height, x_left_spine_limit, end_point_up_left_y)
+ c.line(x_left_spine_limit, end_point_up_left_y, x_left_spine_limit, middle_point_up_left_y)
+ c.line(x_left_spine_limit, middle_point_up_left_y, start_up_left_left_x, half_height)
# cut lower right
- start_down_right_left_x = x_right_SPINE_LIMIT - 0.5 * CUT_WIDTH
- start_down_right_right_x = x_right_SPINE_LIMIT + 0.5 * CUT_WIDTH
+ start_down_right_left_x = x_right_spine_limit - 0.5 * CUT_WIDTH
+ start_down_right_right_x = x_right_spine_limit + 0.5 * CUT_WIDTH
middle_point_down_right_y = half_height - MIDDLE_POINT_DEPTH
end_point_down_right_y = half_height - CUT_DEPTH
- c.line(start_down_right_left_x, half_height, x_right_SPINE_LIMIT, end_point_down_right_y)
- c.line(x_right_SPINE_LIMIT, end_point_down_right_y, x_right_SPINE_LIMIT, middle_point_down_right_y)
- c.line(x_right_SPINE_LIMIT, middle_point_down_right_y, start_down_right_right_x, half_height)
+ c.line(start_down_right_left_x, half_height, x_right_spine_limit, end_point_down_right_y)
+ c.line(x_right_spine_limit, end_point_down_right_y, x_right_spine_limit, middle_point_down_right_y)
+ c.line(x_right_spine_limit, middle_point_down_right_y, start_down_right_right_x, half_height)
if args.analyze or front_page:
c.save()
new_pdf = pypdf.PdfReader(packet)