From 77c8dd7fe6178301d4d31bade80d27bfd6ce6308 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Tue, 14 Jan 2025 00:52:00 -0500 Subject: [PATCH] add invertln and title helpers --- printer.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/printer.py b/printer.py index 10c4274..7032872 100644 --- a/printer.py +++ b/printer.py @@ -81,6 +81,10 @@ class ReceiptPrinter(CupsPrinter): with self.set(invert=True): self.text(text) + def invertln(self, text): + self.invert(text) + self.ln() + def bold(self, text): with self.set(bold=True): self.text(text) @@ -89,4 +93,15 @@ class ReceiptPrinter(CupsPrinter): self.bold(text) self.ln() + def title(self, text, size=6, width=None, height=None): + width = width or size + height = height or size + with self.set(align="center", bold=True, invert=True, smooth=True, custom_size=True, width=width, height=height): + self.textln(text) + self.ln() + + def subtitle(self, text): + with self.set(align="center", double_height=True, double_width=True): + p.textln(text) + p = ReceiptPrinter("EPSON-TM-m30", profile="default")