From e708fbc3ed12b80be97b852dbda1965b10d6927b Mon Sep 17 00:00:00 2001 From: Daniele Pantaleo Date: Sun, 22 Oct 2023 23:24:25 +0200 Subject: [PATCH 1/3] Added Code39 --- .../java/com/dantsu/escposprinter/EscPosPrinterCommands.java | 1 + 1 file changed, 1 insertion(+) diff --git a/escposprinter/src/main/java/com/dantsu/escposprinter/EscPosPrinterCommands.java b/escposprinter/src/main/java/com/dantsu/escposprinter/EscPosPrinterCommands.java index c210400..445a399 100644 --- a/escposprinter/src/main/java/com/dantsu/escposprinter/EscPosPrinterCommands.java +++ b/escposprinter/src/main/java/com/dantsu/escposprinter/EscPosPrinterCommands.java @@ -68,6 +68,7 @@ public class EscPosPrinterCommands { public static final int BARCODE_TYPE_UPCE = 66; public static final int BARCODE_TYPE_EAN13 = 67; public static final int BARCODE_TYPE_EAN8 = 68; + public static final int BARCODE_TYPE_39 = 69; public static final int BARCODE_TYPE_ITF = 70; public static final int BARCODE_TYPE_128 = 73; From 2320a75efdad54db56ea42d40a1e48f791afd60a Mon Sep 17 00:00:00 2001 From: Daniele Pantaleo Date: Sun, 22 Oct 2023 23:25:17 +0200 Subject: [PATCH 2/3] Added Code39 --- .../dantsu/escposprinter/textparser/PrinterTextParser.java | 1 + .../escposprinter/textparser/PrinterTextParserBarcode.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParser.java b/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParser.java index 3b7b3ab..0c56113 100644 --- a/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParser.java +++ b/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParser.java @@ -27,6 +27,7 @@ public class PrinterTextParser { public static final String ATTR_BARCODE_TYPE_UPCA = "upca"; public static final String ATTR_BARCODE_TYPE_UPCE = "upce"; public static final String ATTR_BARCODE_TYPE_128 = "128"; + public static final String ATTR_BARCODE_TYPE_39 = "39"; public static final String ATTR_BARCODE_TEXT_POSITION = "text"; public static final String ATTR_BARCODE_TEXT_POSITION_NONE = "none"; public static final String ATTR_BARCODE_TEXT_POSITION_ABOVE = "above"; diff --git a/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParserBarcode.java b/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParserBarcode.java index 792f456..a6e052f 100644 --- a/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParserBarcode.java +++ b/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParserBarcode.java @@ -6,6 +6,7 @@ import com.dantsu.escposprinter.EscPosPrinterCommands; import com.dantsu.escposprinter.barcode.Barcode; import com.dantsu.escposprinter.barcode.Barcode128; +import com.dantsu.escposprinter.barcode.Barcode39; import com.dantsu.escposprinter.barcode.BarcodeEAN13; import com.dantsu.escposprinter.barcode.BarcodeEAN8; import com.dantsu.escposprinter.barcode.BarcodeUPCA; @@ -114,6 +115,9 @@ public PrinterTextParserBarcode(PrinterTextParserColumn printerTextParserColumn, case PrinterTextParser.ATTR_BARCODE_TYPE_128: this.barcode = new Barcode128(printer, code, width, height, textPosition); break; + case PrinterTextParser.ATTR_BARCODE_TYPE_39: + this.barcode = new Barcode39(printer, code, width, height, textPosition); + break; default: throw new EscPosParserException("Invalid barcode attribute : " + PrinterTextParser.ATTR_BARCODE_TYPE); } From 67152abed1bc19c5b801fbf78ef0ef6543b5da3a Mon Sep 17 00:00:00 2001 From: Daniele Pantaleo Date: Sun, 22 Oct 2023 23:26:12 +0200 Subject: [PATCH 3/3] Added Code39 --- .../escposprinter/barcode/Barcode39.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 escposprinter/src/main/java/com/dantsu/escposprinter/barcode/Barcode39.java diff --git a/escposprinter/src/main/java/com/dantsu/escposprinter/barcode/Barcode39.java b/escposprinter/src/main/java/com/dantsu/escposprinter/barcode/Barcode39.java new file mode 100644 index 0000000..628f601 --- /dev/null +++ b/escposprinter/src/main/java/com/dantsu/escposprinter/barcode/Barcode39.java @@ -0,0 +1,21 @@ +package com.dantsu.escposprinter.barcode; + +import com.dantsu.escposprinter.EscPosPrinterSize; +import com.dantsu.escposprinter.EscPosPrinterCommands; +import com.dantsu.escposprinter.exceptions.EscPosBarcodeException; + +public class Barcode39 extends Barcode { + public Barcode39(EscPosPrinterSize printerSize, String code, float widthMM, float heightMM, int textPosition) throws EscPosBarcodeException { + super(printerSize, EscPosPrinterCommands.BARCODE_TYPE_39, code, widthMM, heightMM, textPosition); + } + + @Override + public int getCodeLength() { + return this.code.length(); + } + + @Override + public int getColsCount() { + return (this.getCodeLength() + 4) * 16; + } +}