From cc67cb1c1ed2f97b349d0ca5a7639caf0ef6c841 Mon Sep 17 00:00:00 2001 From: Maximilian Wagenbach Date: Wed, 11 Mar 2020 15:51:16 +0100 Subject: [PATCH 1/4] Added some documentation and error handling to the image center flag. --- src/escpos/escpos.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/escpos/escpos.py b/src/escpos/escpos.py index bfab265..3fa7eee 100644 --- a/src/escpos/escpos.py +++ b/src/escpos/escpos.py @@ -106,6 +106,9 @@ class Escpos(object): * `graphics`: prints with the `GS ( L`-command * `bitImageColumn`: prints with the `ESC *`-command + When trying to center an image make sure you have initialized the printer with a valid profile, that + contains a media width pixel field. Otherwise the centering will have no effect. + :param img_source: PIL image or filename to load: `jpg`, `gif`, `png` or `bmp` :param high_density_vertical: print in high density in vertical direction *default:* True :param high_density_horizontal: print in high density in horizontal direction *default:* True @@ -117,6 +120,10 @@ class Escpos(object): im = EscposImage(img_source) try: + if self.profile.profile_data['media']['width']['pixels'] == "Unknown": + print("The media.width.pixel field of the printer profile is not set. " + + "The center flag will have no effect.") + max_width = int(self.profile.profile_data['media']['width']['pixels']) if im.width > max_width: From f49c1dcb8963e9e7f0938dc44cebdd978444ed59 Mon Sep 17 00:00:00 2001 From: Maximilian Wagenbach Date: Wed, 11 Mar 2020 15:56:51 +0100 Subject: [PATCH 2/4] Updating AUTHORS. --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 2b5edc7..64eab60 100644 --- a/AUTHORS +++ b/AUTHORS @@ -19,6 +19,7 @@ Kristi ldos Lucy Linder Manuel F Martinez +Maximilian Wagenbach Michael Billington Michael Elsdörfer mrwunderbar666 From a2db415559700f9ff71ff96debb7728127dc879c Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Fri, 8 May 2020 23:19:31 +0200 Subject: [PATCH 3/4] remove authors --- AUTHORS | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 AUTHORS diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 01113f4..0000000 --- a/AUTHORS +++ /dev/null @@ -1,42 +0,0 @@ -Ahmed Tahri -akeonly -Alexander Bougakov -Alex Debiasio -Asuki Kono -belono -Christoph Heuel -Cody (Quantified Code Bot) -csoft2k -Curtis // mashedkeyboard -Davis Goglin -Dean Rispin -Dmytro Katyukha -Gerard Marull-Paretas -Hark -Joel Lehtonen -Justin Vieira -kennedy -Kristi -ldos -Lucy Linder -Manuel F Martinez -Maximilian Wagenbach -Michael Billington -Michael Elsdörfer -mrwunderbar666 -Nathan Bookham -Omer Akram -Patrick Kanzler -primax79 -Qian Linfeng -Ramon Poca -reck31 -Renato Lorenzi -Romain Porte -Sam Cheng -Sergio Pulgarin -Stephan Sokolow -Thijs Triemstra -Thomas van den Berg -Yaisel Hurtado -ysuolmai From 34cd1ebde1d452c7143c77df93518835167fd1fd Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Fri, 8 May 2020 23:19:47 +0200 Subject: [PATCH 4/4] readd authors --- AUTHORS | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 AUTHORS diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..01113f4 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,42 @@ +Ahmed Tahri +akeonly +Alexander Bougakov +Alex Debiasio +Asuki Kono +belono +Christoph Heuel +Cody (Quantified Code Bot) +csoft2k +Curtis // mashedkeyboard +Davis Goglin +Dean Rispin +Dmytro Katyukha +Gerard Marull-Paretas +Hark +Joel Lehtonen +Justin Vieira +kennedy +Kristi +ldos +Lucy Linder +Manuel F Martinez +Maximilian Wagenbach +Michael Billington +Michael Elsdörfer +mrwunderbar666 +Nathan Bookham +Omer Akram +Patrick Kanzler +primax79 +Qian Linfeng +Ramon Poca +reck31 +Renato Lorenzi +Romain Porte +Sam Cheng +Sergio Pulgarin +Stephan Sokolow +Thijs Triemstra +Thomas van den Berg +Yaisel Hurtado +ysuolmai