aspose.barcode 24.2.0 → 24.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,8 +43,6 @@ class BarCodeReaderExamples
43
43
  let full_path = this.subfolder + file_name;
44
44
  let reader = new BarCodeReader(full_path, null, null);
45
45
  reader.setQualitySettings(QualitySettings.getHighPerformance());
46
- reader.getQualitySettings().setAllowMedianSmoothing(true);
47
- reader.getQualitySettings().setMedianSmoothingWindowSize(5);
48
46
 
49
47
  reader.readBarCodes().forEach(function (result, i, results)
50
48
  {
@@ -4,7 +4,7 @@ const joint_ = require('./Joint');
4
4
  const complexbarcode_ = require("./ComplexBarcode");
5
5
  const generation_ = require("./Generation");
6
6
  const recognition_ = require("./Recognition");
7
- const jar_name_ = "/aspose-barcode-nodejs-24.2.jar";
7
+ const jar_name_ = "/aspose-barcode-nodejs-24.4.jar";
8
8
  const jar_path_ = __dirname + jar_name_;
9
9
  const fs = require("fs");
10
10
 
@@ -1841,6 +1841,15 @@ class MaxiCodeStructuredCodetext extends MaxiCodeCodetext
1841
1841
  return this.getJavaClass().getPostalCodeSync();
1842
1842
  }
1843
1843
 
1844
+ /**
1845
+ * Identifies the postal code. Must be 9 digits in mode 2 or
1846
+ * 6 alphanumeric symbols in mode 3.
1847
+ */
1848
+ setPostalCode(value)
1849
+ {
1850
+ this.getJavaClass().setPostalCodeSync(value);
1851
+ }
1852
+
1844
1853
  /**
1845
1854
  * Identifies 3 digit country code.
1846
1855
  */
package/lib/Generation.js CHANGED
@@ -681,6 +681,7 @@ class BaseGenerationParameters extends joint.BaseJavaClass
681
681
  captionBelow;
682
682
  barcodeParameters;
683
683
  borderParameters;
684
+ image;
684
685
 
685
686
  imageWidth;
686
687
  imageHeight;
@@ -699,6 +700,7 @@ class BaseGenerationParameters extends joint.BaseJavaClass
699
700
  this.borderParameters = new BorderParameters(this.getJavaClass().getBorderSync());
700
701
  this.imageWidth = new Unit(this.getJavaClass().getImageWidthSync());
701
702
  this.imageHeight = new Unit(this.getJavaClass().getImageHeightSync());
703
+ this.image = new ImageParameters(this.getJavaClass().getImageSync());
702
704
  }
703
705
 
704
706
  /**
@@ -769,6 +771,15 @@ class BaseGenerationParameters extends joint.BaseJavaClass
769
771
  this.getJavaClass().setResolutionSync(java.newFloat(value));
770
772
  }
771
773
 
774
+ /**
775
+ * Image parameters. See ImageParameters.
776
+ * @return ImageParameters
777
+ */
778
+ getImage()
779
+ {
780
+ return this.image;
781
+ }
782
+
772
783
  /**
773
784
  * BarCode image rotation angle, measured in degree, e.g. RotationAngle = 0 or RotationAngle = 360 means no rotation.<br>
774
785
  * If RotationAngle NOT equal to 90, 180, 270 or 0, it may increase the difficulty for the scanner to read the image<br>.
@@ -2544,8 +2555,8 @@ class GS1CompositeBarParameters extends joint.BaseJavaClass
2544
2555
  }
2545
2556
 
2546
2557
  /**
2547
- * Returns a human-readable string representation of this <see cref="DataBarParameters"/>.
2548
- * @return A string that represents this <see cref="DataBarParameters"/>
2558
+ * Returns a human-readable string representation of this DataBarParameters.
2559
+ * @return A string that represents this DataBarParameters
2549
2560
  */
2550
2561
  toString()
2551
2562
  {
@@ -5107,52 +5118,93 @@ class HanXinExtCodetextBuilder extends joint.BaseJavaClass
5107
5118
  }
5108
5119
 
5109
5120
  /**
5110
- * Enable checksum validation during recognition for 1D barcodes.<br>
5111
- * Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.<br>
5112
- * Checksum never used: Codabar<br>
5113
- * Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN<br>
5114
- * Checksum always used: Rest symbologies
5115
- * @example
5116
- * //This sample shows influence of ChecksumValidation on recognition quality and results
5117
- * let generator = new BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128");
5118
- * generator.save("test.png", BarcodeImageFormat.PNG);
5119
- * let reader = new BarCodeReader("test.png", DecodeType.EAN_13);
5120
- * //checksum disabled
5121
- * reader.setChecksumValidation(ChecksumValidation.OFF);
5122
- * reader.readBarCodes().forEach(function(result, i, results)
5123
- * {
5124
- * console.log("BarCode CodeText: " + result.getCodeText());
5125
- * console.log("BarCode Value: " + result.getExtended().getOneD().getValue());
5126
- * console.log("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum());
5127
- * });
5128
- * let reader = new BarCodeReader("test.png", DecodeType.EAN_13);
5129
- * //checksum enabled
5130
- * reader.setChecksumValidation(ChecksumValidation.ON);
5131
- * reader.readBarCodes().forEach(function(result, i, results)
5132
- * {
5133
- * console.log("BarCode CodeText: " + result.getCodeText());
5134
- * console.log("BarCode Value: " + result.getExtended().getOneD().getValue());
5135
- * console.log("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum());
5136
- * });
5137
- * @enum
5121
+ * Image parameters.
5138
5122
  */
5139
- ChecksumValidation =
5123
+ class ImageParameters extends joint.BaseJavaClass
5124
+ {
5125
+ svg;
5126
+
5127
+ constructor(javaClass)
5140
5128
  {
5141
- /**
5142
- * If checksum is required by the specification - it will be validated.
5143
- */
5144
- DEFAULT: 0,
5129
+ super(javaClass);
5130
+ this.init();
5131
+ }
5145
5132
 
5146
- /**
5147
- * Always validate checksum if possible.
5148
- */
5149
- ON: 1,
5133
+ init()
5134
+ {
5135
+ this.svg = new SvgParameters(this.getJavaClass().getSvgSync());
5136
+ }
5150
5137
 
5151
- /**
5152
- * Do not validate checksum.
5153
- */
5154
- OFF: 2
5155
- };
5138
+ /**
5139
+ * SVG parameters
5140
+ */
5141
+ getSvg()
5142
+ {
5143
+ return this.svg;
5144
+ }
5145
+
5146
+ /**
5147
+ * SVG parameters
5148
+ */
5149
+ setSvg(svg)
5150
+ {
5151
+ this.svg = svg;
5152
+ this.getJavaClass().setSvgSync(svg.getJavaClass());
5153
+ }
5154
+ }
5155
+
5156
+
5157
+ /**
5158
+ * SVG parameters.
5159
+ */
5160
+ class SvgParameters extends joint.BaseJavaClass
5161
+ {
5162
+ constructor(javaClass)
5163
+ {
5164
+ super(javaClass);
5165
+ this.init();
5166
+ }
5167
+
5168
+ init()
5169
+ {
5170
+ }
5171
+
5172
+ /**
5173
+ * Does SVG image contain explicit size in pixels (recommended)
5174
+ * Default value: true.
5175
+ */
5176
+ isExplicitSizeInPixels()
5177
+ {
5178
+ return this.getJavaClass().isExplicitSizeInPixelsSync();
5179
+ }
5180
+
5181
+ /**
5182
+ * Does SVG image contain explicit size in pixels (recommended)
5183
+ * Default value: true.
5184
+ */
5185
+ setExplicitSizeInPixels(explicitSizeInPixels)
5186
+ {
5187
+ this.getJavaClass().setExplicitSizeInPixelsSync(explicitSizeInPixels);
5188
+ }
5189
+
5190
+ /**
5191
+ * Does SVG image contain text as text element rather than paths (recommended)
5192
+ * Default value: true.
5193
+ */
5194
+ isTextDrawnInTextElement()
5195
+ {
5196
+ return this.getJavaClass().isTextDrawnInTextElementSync();
5197
+ }
5198
+
5199
+ /**
5200
+ * Does SVG image contain text as text element rather than paths (recommended)
5201
+ * Default value: true.
5202
+ */
5203
+ setTextDrawnInTextElement(textDrawnInTextElement)
5204
+ {
5205
+ this.getJavaClass().setTextDrawnInTextElementSync(textDrawnInTextElement);
5206
+ }
5207
+ }
5156
5208
 
5157
5209
  /**
5158
5210
  * BarcodeClassifications EncodeTypes classification
@@ -8908,7 +8960,6 @@ module.exports = {
8908
8960
  BarcodeParameters,
8909
8961
  BaseGenerationParameters,
8910
8962
  BorderParameters,
8911
- ChecksumValidation,
8912
8963
  CaptionParameters,
8913
8964
  BorderDashStyle,
8914
8965
  AutoSizeMode,
@@ -8976,5 +9027,7 @@ module.exports = {
8976
9027
  AztecEncodeMode,
8977
9028
  AztecExtCodetextBuilder,
8978
9029
  MicroQRVersion,
8979
- RectMicroQRVersion
9030
+ RectMicroQRVersion,
9031
+ ImageParameters,
9032
+ SvgParameters
8980
9033
  };
@@ -1,6 +1,7 @@
1
1
  const fs = require("fs");
2
2
  const java = require('java');
3
3
  const joint = require("./Joint");
4
+ const {Rectangle} = require("./Joint");
4
5
 
5
6
  /**
6
7
  * BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform ReadBarCodes operation to detect barcodes.
@@ -43,14 +44,13 @@ class BarCodeReader extends joint.BaseJavaClass
43
44
  {
44
45
  if (!Array.isArray(rectangles))
45
46
  {
46
- rectangles = [rectangles.toString()];
47
+ rectangles = [rectangles];
47
48
  }
48
- else
49
+ for (let i = 0; i < rectangles.length; i++)
49
50
  {
50
- for (let i = 0; i < rectangles.length; i++)
51
- {
52
- rectangles[i] = rectangles[i].toString();
53
- }
51
+ if(!(rectangles[i] instanceof Rectangle))
52
+ throw new Error("Invalid arguments");
53
+ rectangles[i] = rectangles[i].toString();
54
54
  }
55
55
  }
56
56
  if (decodeTypes === undefined || decodeTypes == null)
@@ -3587,6 +3587,61 @@ BarCodeConfidence =
3587
3587
  STRONG: 100
3588
3588
  };
3589
3589
 
3590
+ /**
3591
+ * Enable checksum validation during recognition for 1D barcodes.
3592
+ *
3593
+ * Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.
3594
+ *
3595
+ * Checksum never used: Codabar
3596
+ *
3597
+ * Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN
3598
+ *
3599
+ * Checksum always used: Rest symbologies
3600
+ *
3601
+ * This sample shows influence of ChecksumValidation on recognition quality and results
3602
+ * \code
3603
+ * generator = BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128")
3604
+ * generator.save("test.png", BarCodeImageFormat.PNG)
3605
+ * reader = Recognition.BarCodeReader("test.png", None, DecodeType.EAN_13)
3606
+ * #checksum disabled
3607
+ * reader.setChecksumValidation(ChecksumValidation.OFF)
3608
+ * for result in reader.readBarCodes():
3609
+ * print("BarCode CodeText: " + result.getCodeText())
3610
+ * print("BarCode Value: " + result.getExtended().getOneD().getValue())
3611
+ * print("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum())
3612
+ *
3613
+ * \endcode
3614
+ * \code
3615
+ * reader = Recognition.BarCodeReader("test.png", None, DecodeType.EAN_13)
3616
+ * #checksum enabled
3617
+ * reader.setChecksumValidation(ChecksumValidation.ON)
3618
+ * for result in reader.readBarCodes():
3619
+ * print("BarCode CodeText: " + result.getCodeText())
3620
+ * print("BarCode Value: " + result.getExtended().getOneD().getValue())
3621
+ * print("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum())
3622
+ * \endcode
3623
+ *
3624
+ */
3625
+ ChecksumValidation =
3626
+ {
3627
+
3628
+ /**
3629
+ * If checksum is required by the specification - it will be validated.
3630
+ */
3631
+
3632
+ DEFAULT: 0,
3633
+
3634
+ /**
3635
+ * Always validate checksum if possible.
3636
+ */
3637
+ ON: 1,
3638
+
3639
+ /**
3640
+ * Do not validate checksum
3641
+ */
3642
+ OFF: 2
3643
+ }
3644
+
3590
3645
  /**
3591
3646
  * <p>
3592
3647
  * <p>
@@ -3771,6 +3826,7 @@ module.exports = {
3771
3826
  OneDExtendedParameters,
3772
3827
  Code128ExtendedParameters,
3773
3828
  DecodeType,
3829
+ ChecksumValidation,
3774
3830
  BarCodeResult,
3775
3831
  BarCodeRegionParameters,
3776
3832
  BarCodeExtendedParameters,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aspose.barcode",
3
- "version": "24.2.0",
3
+ "version": "24.4.0",
4
4
  "description": "barcode generation and recognition component",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"