diff --git a/src/escpos/printer/file.py b/src/escpos/printer/file.py index 77e9205..a8933ce 100644 --- a/src/escpos/printer/file.py +++ b/src/escpos/printer/file.py @@ -99,6 +99,7 @@ class File(Escpos): if not self._device: return logging.info("Closing File connection to printer %s", self.devfile) - self.device.flush() + if not self.auto_flush: + self.flush() self.device.close() self._device = False diff --git a/src/escpos/printer/lp.py b/src/escpos/printer/lp.py index 4c924b8..e0824e4 100644 --- a/src/escpos/printer/lp.py +++ b/src/escpos/printer/lp.py @@ -67,11 +67,11 @@ class LP(Escpos): :param printer_name: CUPS printer name (Optional) :param auto_flush: Automatic flush after every _raw() (Optional) - :type auto_flush: bool + :type auto_flush: bool (Defaults False) """ Escpos.__init__(self, *args, **kwargs) self.printer_name = printer_name - self.auto_flush = kwargs.get("auto_flush", True) + self.auto_flush = kwargs.get("auto_flush", False) @property def printers(self) -> dict: @@ -150,6 +150,8 @@ class LP(Escpos): if not self._device: return logging.info("Closing LP connection to printer %s", self.printer_name) + if not self.auto_flush: + self.flush() self.device.terminate() self._device = False