From c52e26991afebfffcb75af6d14870e6ddac8f22a Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Fri, 7 Feb 2020 18:32:08 +0100 Subject: [PATCH 1/3] Add receipt tags to lang --- htdocs/langs/en_US/receiptprinter.lang | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/langs/en_US/receiptprinter.lang b/htdocs/langs/en_US/receiptprinter.lang index f79974558d6..9a3b28fa399 100644 --- a/htdocs/langs/en_US/receiptprinter.lang +++ b/htdocs/langs/en_US/receiptprinter.lang @@ -47,3 +47,10 @@ DOL_PRINT_LOGO=Print logo of my company DOL_PRINT_LOGO_OLD=Print logo of my company (old printers) DOL_BOLD=Bold DOL_BOLD_DISABLED=Disable bold +DOL_DOUBLE_HEIGHT=Double height size +DOL_DOUBLE_WIDTH=Double width size +DOL_DEFAULT_HEIGHT_WIDTH=Default height and width size +DOL_UNDERLINE=Enable underline +DOL_UNDERLINE_DISABLED=Disable underline +DOL_BEEP=Beed sound +DOL_PRINT_TEXT=Print text From ae061511469f2b8396cc917ff313913de2a4b762 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Fri, 7 Feb 2020 18:34:58 +0100 Subject: [PATCH 2/3] Add and finish receipt printer tags --- htdocs/core/class/dolreceiptprinter.class.php | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 4738ea92974..0c37832f00c 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2020 Andreu Bisquerra * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,19 +33,16 @@ * Use font C of printer * Text Bold * Disable Text Bold - * Text double height - * Text double width - * Underline text - * Underline with double line - * Emphasized text - * Print in white on black - * Ticket print width of 57mm + * Text double height + * Text double width + * Text default height and width + * Underline text + * Disable underline text * Cut ticket completely * Cut ticket partially * Open cash drawer - * Activate buzzer + * Activate buzzer * Print barcode - * Print QR Code * Print logo stored on printer. Example : 32|32 * Print logo stored on printer. Must be followed by logo code. For old printers. * Print object lines @@ -165,24 +163,15 @@ class dolReceiptPrinter extends Printer 'dol_bold', 'dol_bold_disabled', 'dol_double_height', - '/dol_double_height', 'dol_double_width', - '/dol_double_width', + 'dol_default_height_width', 'dol_underline', - '/dol_underline', - 'dol_underline_2dots', - '/dol_underline', - 'dol_emphasized', - '/dol_emphasized', - 'dol_switch_colors', - '/dol_switch_colors', - 'dol_set_print_width_57', + 'dol_underline_disabled', 'dol_cut_paper_full', 'dol_cut_paper_partial', 'dol_open_drawer', - //'dol_activate_buzzer', + 'dol_beep', 'dol_print_text', - 'dol_print_qrcode', 'dol_print_barcode', 'dol_value_date', 'dol_value_date_time', @@ -718,6 +707,24 @@ class dolReceiptPrinter extends Printer break; case 'DOL_BOLD_DISABLED': $this->printer->setEmphasis(false); + break; + case 'DOL_DOUBLE_HEIGHT': + $this->printer->setTextSize(1,2); + break; + case 'DOL_DOUBLE_WIDTH': + $this->printer->setTextSize(2,1); + break; + case 'DOL_DEFAULT_HEIGHT_WIDTH': + $this->printer->setTextSize(1,1); + break; + case 'DOL_UNDERLINE': + $this->printer->setUnderline(true); + break; + case 'DOL_UNDERLINE_DISABLED': + $this->printer->setUnderline(false); + break; + case 'DOL_BEEP': + $this->printer->getPrintConnector() -> write("\x1e"); break; default: $this->printer->text($vals[$tplline]['tag']); @@ -826,3 +833,4 @@ class dolReceiptPrinter extends Printer return $error; } } + From 1e5940fbf0dfd9ecf46f4965a4215e00943cb4dd Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Fri, 7 Feb 2020 19:25:28 +0100 Subject: [PATCH 3/3] Fix travis errors --- htdocs/core/class/dolreceiptprinter.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 0c37832f00c..e8e43281d79 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -709,13 +709,13 @@ class dolReceiptPrinter extends Printer $this->printer->setEmphasis(false); break; case 'DOL_DOUBLE_HEIGHT': - $this->printer->setTextSize(1,2); + $this->printer->setTextSize(1, 2); break; case 'DOL_DOUBLE_WIDTH': - $this->printer->setTextSize(2,1); + $this->printer->setTextSize(2, 1); break; case 'DOL_DEFAULT_HEIGHT_WIDTH': - $this->printer->setTextSize(1,1); + $this->printer->setTextSize(1, 1); break; case 'DOL_UNDERLINE': $this->printer->setUnderline(true); @@ -833,4 +833,3 @@ class dolReceiptPrinter extends Printer return $error; } } -