diff --git a/src/escpos/escpos.py b/src/escpos/escpos.py index 17e0d12..24f6475 100644 --- a/src/escpos/escpos.py +++ b/src/escpos/escpos.py @@ -479,7 +479,8 @@ class Escpos(object): self._raw(NUL) def soft_barcode(self, barcode_type, data, impl='bitImageColumn', - module_height=5, module_width=0.2, text_distance=1): + module_height=5, module_width=0.2, text_distance=1, + center=True): image_writer = ImageWriter() @@ -502,7 +503,7 @@ class Escpos(object): # Retrieve the Pillow image and print it image = my_code.writer._image - self.image(image, impl=impl) + self.image(image, impl=impl, center=center) def text(self, txt): """ Print alpha-numeric text diff --git a/test/test_function_softbarcode.py b/test/test_function_softbarcode.py index f9288f7..fc702d7 100644 --- a/test/test_function_softbarcode.py +++ b/test/test_function_softbarcode.py @@ -12,3 +12,6 @@ def instance(): def test_soft_barcode_ean8(instance): instance.soft_barcode("ean8", "1234") + +def test_soft_barcode_ean8_nocenter(instance): + instance.soft_barcode("ean8", "1234", center=False)