made the print lost label page
This commit is contained in:
@@ -24,9 +24,9 @@ def mm_to_points(mm_value):
|
||||
|
||||
class LabelPDFGenerator:
|
||||
def __init__(self, paper_saving_mode=True):
|
||||
# Label dimensions: 80mm x 110mm
|
||||
# Label dimensions: 80mm x 105mm (reduced from 110mm by cutting 5mm from bottom)
|
||||
self.label_width = mm_to_points(80)
|
||||
self.label_height = mm_to_points(110)
|
||||
self.label_height = mm_to_points(105)
|
||||
|
||||
# Paper-saving mode: positions content at top of label to minimize waste
|
||||
self.paper_saving_mode = paper_saving_mode
|
||||
@@ -35,19 +35,21 @@ class LabelPDFGenerator:
|
||||
# Preview: 227.4px width x 321.3px height
|
||||
# Convert to proportional dimensions for 80x110mm
|
||||
self.content_width = mm_to_points(60) # ~227px scaled to 80mm
|
||||
self.content_height = mm_to_points(85) # ~321px scaled to 110mm
|
||||
self.content_height = mm_to_points(68) # Reduced by 20% from 85mm to 68mm
|
||||
|
||||
# Position content in label - optimized for paper saving
|
||||
# Position content in label - rectangle positioned 15mm from top
|
||||
# Label height: 105mm, Rectangle height: 68mm
|
||||
# content_y = 105mm - 15mm - 68mm = 22mm from bottom
|
||||
if self.paper_saving_mode:
|
||||
# Start content from top of label with minimal top margin
|
||||
self.content_x = mm_to_points(4) # 4mm from left edge (was 3mm, moved 1mm right to ensure left border prints)
|
||||
self.content_y = mm_to_points(20) # 20mm from bottom (more space at top)
|
||||
self.top_margin = mm_to_points(5) # 5mm top margin instead of larger bottom margin
|
||||
# Start content from top of label with 15mm top margin
|
||||
self.content_x = mm_to_points(4) # 4mm from left edge
|
||||
self.content_y = mm_to_points(22) # 22mm from bottom (15mm from top)
|
||||
self.top_margin = mm_to_points(15) # 15mm top margin
|
||||
else:
|
||||
# Original positioning
|
||||
self.content_x = mm_to_points(5) # 5mm from left edge (was 4mm, moved 1mm right to ensure left border prints)
|
||||
self.content_y = mm_to_points(15) # 15mm from bottom (space for bottom barcode)
|
||||
self.top_margin = mm_to_points(10)
|
||||
self.content_x = mm_to_points(5) # 5mm from left edge
|
||||
self.content_y = mm_to_points(22) # 22mm from bottom (15mm from top)
|
||||
self.top_margin = mm_to_points(15) # 15mm top margin
|
||||
|
||||
# Row dimensions (9 rows total, row 6 is double height)
|
||||
self.row_height = self.content_height / 10 # 8.5mm per standard row
|
||||
@@ -288,6 +290,10 @@ class LabelPDFGenerator:
|
||||
canvas.drawString(ac_x_centered, row_y + self.row_height/3, article_code)
|
||||
current_y = row_y
|
||||
|
||||
# Draw horizontal line between Article Code and Prod Order
|
||||
canvas.setLineWidth(1)
|
||||
canvas.line(self.content_x, current_y, self.content_x + self.content_width, current_y)
|
||||
|
||||
# Row 9: Prod Order - CORRECTED to match HTML preview with sequential numbering
|
||||
row_y = current_y - self.row_height
|
||||
canvas.setFont("Helvetica", 8)
|
||||
@@ -307,9 +313,9 @@ class LabelPDFGenerator:
|
||||
line_y -= self.row_height
|
||||
canvas.line(self.content_x, line_y, self.content_x + self.content_width, line_y)
|
||||
|
||||
# Bottom horizontal barcode - positioned within label bounds
|
||||
# Bottom horizontal barcode - positioned 1.5mm below the main rectangle
|
||||
barcode_area_height = mm_to_points(12) # Reserve space for barcode
|
||||
barcode_y = mm_to_points(3) # 3mm from bottom of label (moved down 1mm for more space)
|
||||
barcode_y = self.content_y - mm_to_points(1.5) - barcode_area_height # 1.5mm gap below rectangle
|
||||
barcode_width = self.content_width # Use full content width
|
||||
barcode_x = self.content_x
|
||||
|
||||
|
||||
Reference in New Issue
Block a user