Fix blank label between copies: send all copies in single GDI print job (StartDoc/N pages/EndDoc) instead of N separate jobs - thermal printers eject blank label between rapid separate jobs

This commit is contained in:
2026-02-25 16:20:45 +02:00
parent be1b494527
commit 71ccdb7b96
3 changed files with 33 additions and 34 deletions

View File

@@ -982,23 +982,13 @@ printer = PDF
success = False
all_success = True
try:
# Print multiple copies if count > 1
for i in range(count):
if count > 1:
Clock.schedule_once(lambda dt, idx=i: popup.content.children[0].text.replace(
f'Processing {count} label(s)...',
f'Printing {idx+1} of {count}...'
), 0)
success = print_label_standalone(label_text, printer, preview=0, svg_template=template_path)
if not success:
all_success = False
break
# Small delay between prints for multiple copies
if i < count - 1:
time.sleep(0.5)
# Send all copies in ONE print job to prevent blank labels
# being ejected between separate jobs on thermal printers.
success = print_label_standalone(
label_text, printer, preview=0,
svg_template=template_path, copies=count
)
all_success = success
# Get the PDF filename that was created
# Files are saved to pdf_backup/ with timestamp