aspose.barcode 21.10.5 → 22.1.5

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.
@@ -7,7 +7,7 @@ const recognition_ = require("./Recognition");
7
7
 
8
8
  function pushJar()
9
9
  {
10
- java.classpath.push(__dirname + "/aspose-barcode-nodejs-21.10.jar");
10
+ java.classpath.push(__dirname + "/aspose-barcode-nodejs-22.1.jar");
11
11
  }
12
12
  pushJar();
13
13
 
@@ -400,6 +400,7 @@ class Address extends joint.BaseJavaClass {
400
400
 
401
401
  /**
402
402
  * Address type
403
+ * @enum
403
404
  */
404
405
  AddressType =
405
406
  {
@@ -519,10 +520,30 @@ class ComplexCodetextReader {
519
520
  let javaJsComplexCodetextReader = java.import(ComplexCodetextReader.javaClassName);
520
521
  return Mailmark2DCodetext.construct(javaJsComplexCodetextReader.tryDecodeMailmark2DSync(encodedCodetext));
521
522
  }
523
+
524
+ /**
525
+ * Decodes Mailmark Barcode C and L codetext.
526
+ * @param encodedCodetext encoded codetext
527
+ * @return Decoded Mailmark Barcode C and L or null.
528
+ */
529
+ static tryDecodeMailmark(encodedCodetext)
530
+ {
531
+ let res = new MailmarkCodetext(null);
532
+ try
533
+ {
534
+ res.initFromString(encodedCodetext);
535
+ }
536
+ catch (e)
537
+ {
538
+ return null;
539
+ }
540
+ return res;
541
+ }
522
542
  }
523
543
 
524
544
  /**
525
545
  * SwissQR bill standard version
546
+ * @enum
526
547
  */
527
548
  QrBillStandardVersion =
528
549
  {
@@ -883,6 +904,163 @@ class SwissQRCodetext extends IComplexCodetext {
883
904
  }
884
905
  }
885
906
 
907
+
908
+ /**
909
+ * Class for encoding and decoding the text embedded in the 4-state Royal Mailmark code.
910
+ */
911
+ class MailmarkCodetext extends IComplexCodetext
912
+ {
913
+ static javaClassName = "com.aspose.mw.barcode.complexbarcode.MwMailmarkCodetext";
914
+ /**
915
+ * "0" – Null or Test
916
+ * "1" – Letter
917
+ * "2" – Large Letter
918
+ */
919
+ getFormat()
920
+ { return this.getJavaClass().getFormatSync(); }
921
+ /**
922
+ * "0" – Null or Test
923
+ * "1" – LetterN
924
+ * "2" – Large Letter
925
+ */
926
+ setFormat(value)
927
+ { this.getJavaClass().setFormatSync(value); }
928
+
929
+ /**
930
+ * Currently "1" – For Mailmark barcode (0 and 2 to 9 and A to Z spare for future use)
931
+ */
932
+ getVersionID()
933
+ { return this.getJavaClass().getVersionIDSync(); }
934
+
935
+ /**
936
+ * Currently "1" – For Mailmark barcode (0 and 2 to 9 and A to Z spare for future use)
937
+ */
938
+ setVersionID(value)
939
+ { this.getJavaClass().setVersionIDSync(value); }
940
+
941
+ /**
942
+ * "0" - Null or Test
943
+ * "1" - 1C (Retail)
944
+ * "2" - 2C (Retail)
945
+ * "3" - 3C (Retail)
946
+ * "4" - Premium (RetailPublishing Mail) (for potential future use)
947
+ * "5" - Deferred (Retail)
948
+ * "6" - Air (Retail) (for potential future use)
949
+ * "7" - Surface (Retail) (for potential future use)
950
+ * "8" - Premium (Network Access)
951
+ * "9" - Standard (Network Access)
952
+ */
953
+ getClass_()
954
+ { return this.getJavaClass().getClass_Sync(); }
955
+
956
+ /**
957
+ * "0" - Null or Test
958
+ * "1" - 1C (Retail)
959
+ * "2" - 2C (Retail)
960
+ * "3" - 3C (Retail)
961
+ * "4" - Premium (RetailPublishing Mail) (for potential future use)
962
+ * "5" - Deferred (Retail)
963
+ * "6" - Air (Retail) (for potential future use)
964
+ * "7" - Surface (Retail) (for potential future use)
965
+ * "8" - Premium (Network Access)
966
+ * "9" - Standard (Network Access)
967
+ */
968
+ setClass(value)
969
+ { this.getJavaClass().setClassSync(value); }
970
+
971
+ /**
972
+ * Maximum values are 99 for Barcode C and 999999 for Barcode L.
973
+ */
974
+ getSupplychainID()
975
+ { return this.getJavaClass().getSupplychainIDSync(); }
976
+ /**
977
+ * Maximum values are 99 for Barcode C and 999999 for Barcode L.
978
+ */
979
+ setSupplychainID(value)
980
+ { this.getJavaClass().setSupplychainIDSync(value); }
981
+
982
+ /**
983
+ * Maximum value is 99999999.
984
+ */
985
+ getItemID()
986
+ { return this.getJavaClass().getItemIDSync(); }
987
+
988
+ /**
989
+ * Maximum value is 99999999.
990
+ */
991
+ setItemID(value)
992
+ { this.getJavaClass().setItemIDSync(value); }
993
+
994
+ /**
995
+ * The PC and DP must comply with a PAF format.
996
+ * Nine character string denoting international "XY11 " (note the 5 trailing spaces) or a pattern
997
+ * of characters denoting a domestic sorting code.
998
+ * A domestic sorting code consists of an outward postcode, an inward postcode, and a Delivery Point Suffix.
999
+ */
1000
+ getDestinationPostCodePlusDPS()
1001
+ { return this.getJavaClass().getDestinationPostCodePlusDPSSync(); }
1002
+
1003
+ /**
1004
+ * The PC and DP must comply with a PAF format.
1005
+ * Nine character string denoting international "XY11 " (note the 5 trailing spaces) or a pattern
1006
+ * of characters denoting a domestic sorting code.
1007
+ * A domestic sorting code consists of an outward postcode, an inward postcode, and a Delivery Point Suffix.
1008
+ */
1009
+ setDestinationPostCodePlusDPS(value)
1010
+ { this.getJavaClass().setDestinationPostCodePlusDPSSync(value); }
1011
+
1012
+ /**
1013
+ * Initializes a new instance of the {@code MailmarkCodetext} class.
1014
+ */
1015
+ constructor(mailmarkCodetext)
1016
+ {
1017
+ let java_class_link = java.import(MailmarkCodetext.javaClassName);
1018
+ let javaClass = null;
1019
+ if (mailmarkCodetext == null)
1020
+ {
1021
+ javaClass = new java_class_link();
1022
+ }
1023
+ else
1024
+ {
1025
+ javaClass = new java_class_link(mailmarkCodetext.getJavaClass());
1026
+ }
1027
+ super(javaClass);
1028
+ }
1029
+
1030
+ init()
1031
+ {}
1032
+
1033
+ /**
1034
+ * Construct codetext from Mailmark data.
1035
+ *
1036
+ * @return Constructed codetext
1037
+ */
1038
+ getConstructedCodetext()
1039
+ {
1040
+ return this.getJavaClass().getConstructedCodetextSync();
1041
+ }
1042
+
1043
+ /**
1044
+ * Initializes Mailmark data from constructed codetext.
1045
+ *
1046
+ * @param constructedCodetext Constructed codetext.
1047
+ */
1048
+ initFromString(constructedCodetext)
1049
+ {
1050
+ this.getJavaClass().initFromStringSync(constructedCodetext);
1051
+ }
1052
+
1053
+ /**
1054
+ * Gets barcode type.
1055
+ *
1056
+ * @return Barcode type.
1057
+ */
1058
+ getBarcodeType()
1059
+ {
1060
+ return this.getJavaClass().getBarcodeTypeSync();
1061
+ }
1062
+ }
1063
+
886
1064
  class Mailmark2DCodetext extends IComplexCodetext
887
1065
  {
888
1066
 
@@ -1277,6 +1455,7 @@ module.exports = {
1277
1455
  AddressType,
1278
1456
  SwissQRBill,
1279
1457
  Mailmark2DCodetext,
1458
+ MailmarkCodetext,
1280
1459
  Mailmark2DType,
1281
1460
  QrBillStandardVersion
1282
1461
  };
package/lib/Generation.js CHANGED
@@ -45,6 +45,13 @@ class BarcodeGenerator extends joint.BaseJavaClass
45
45
  this.init();
46
46
  }
47
47
 
48
+ static construct(javaClass)
49
+ {
50
+ let barcodeGenerator = new BarcodeGenerator( null, null);
51
+ barcodeGenerator.setJavaClass(javaClass);
52
+ return barcodeGenerator;
53
+ }
54
+
48
55
  init()
49
56
  {
50
57
  this.parameters = new BaseGenerationParameters(this.getJavaClass().getParametersSync());
@@ -65,7 +72,7 @@ class BarcodeGenerator extends joint.BaseJavaClass
65
72
  */
66
73
  getBarcodeType()
67
74
  {
68
- return this.getJavaClass().getBarcodeTypeSync() + "";
75
+ return this.getJavaClass().getBarcodeTypeSync();
69
76
  }
70
77
 
71
78
  /**
@@ -127,6 +134,52 @@ class BarcodeGenerator extends joint.BaseJavaClass
127
134
  {
128
135
  this.getJavaClass().setCodeTextSync(value);
129
136
  }
137
+
138
+ /**
139
+ * Exports BarCode properties to the xml file specified
140
+ * @param filePath The xml file
141
+ * @return Whether or not export completed successfully. Returns <b>True</b> in case of success; <b>False</b> Otherwise </para>
142
+ * @throws IOException
143
+ */
144
+ exportToXml(filePath)
145
+ {
146
+ try
147
+ {
148
+ let xmlData = this.getJavaClass().exportToXmlSync();
149
+ let isSaved = xmlData != null;
150
+ if (isSaved)
151
+ {
152
+ fs.writeFileSync(filePath, xmlData);
153
+ }
154
+ return isSaved;
155
+ }
156
+ catch (ex)
157
+ {
158
+ throw new BarcodeException(ex.getMessage());
159
+ }
160
+ }
161
+
162
+ /**
163
+ * <p>
164
+ * Imports BarCode properties from the xml-file specified and creates BarcodeGenerator instance.
165
+ * </p>
166
+ * @return BarcodeGenerator instance
167
+ * @param filePath The name of the file
168
+ */
169
+ importFromXml(filePath)
170
+ {
171
+ try
172
+ {
173
+ let xmlData = joint.convertResourceToBase64String(filePath);
174
+ let offset = 6;
175
+ xmlData = xmlData.substr(offset);
176
+ return BarcodeGenerator.construct(java(BarcodeGenerator.javaClassName).importFromXmlSync(xmlData));
177
+ }
178
+ catch (ex)
179
+ {
180
+ throw new BarcodeException(ex.getMessage());
181
+ }
182
+ }
130
183
  }
131
184
 
132
185
  /**
@@ -242,9 +295,11 @@ class BarcodeParameters extends joint.BaseJavaClass
242
295
  getBarColor()
243
296
  {
244
297
  let intColor = this.getJavaClass().getBarColorSync();
245
- let hexColor = ((intColor)>>>0).toString(16).slice(-6).toUpperCase()
298
+ let hexColor = ((intColor) >>> 0).toString(16).slice(-6).toUpperCase()
246
299
  while (hexColor.length < 6)
300
+ {
247
301
  hexColor = "0" + hexColor;
302
+ }
248
303
  hexColor = "#" + hexColor;
249
304
  return hexColor;
250
305
  }
@@ -574,9 +629,11 @@ class BaseGenerationParameters extends joint.BaseJavaClass
574
629
  getBackColor()
575
630
  {
576
631
  let intColor = this.getJavaClass().getBackColorSync();
577
- let hexColor = ((intColor)>>>0).toString(16).slice(-6).toUpperCase()
632
+ let hexColor = ((intColor) >>> 0).toString(16).slice(-6).toUpperCase()
578
633
  while (hexColor.length < 6)
634
+ {
579
635
  hexColor = "0" + hexColor;
636
+ }
580
637
  hexColor = "#" + hexColor;
581
638
  return hexColor;
582
639
  }
@@ -850,9 +907,11 @@ class BorderParameters extends joint.BaseJavaClass
850
907
  getColor()
851
908
  {
852
909
  let intColor = this.getJavaClass().getColorSync();
853
- let hexColor = ((intColor)>>>0).toString(16).slice(-6).toUpperCase()
910
+ let hexColor = ((intColor) >>> 0).toString(16).slice(-6).toUpperCase()
854
911
  while (hexColor.length < 6)
912
+ {
855
913
  hexColor = "0" + hexColor;
914
+ }
856
915
  hexColor = "#" + hexColor;
857
916
  return hexColor;
858
917
  }
@@ -988,9 +1047,11 @@ class CaptionParameters extends joint.BaseJavaClass
988
1047
  getTextColor()
989
1048
  {
990
1049
  let intColor = this.getJavaClass().getTextColorSync();
991
- let hexColor = ((intColor)>>>0).toString(16).slice(-6).toUpperCase()
1050
+ let hexColor = ((intColor) >>> 0).toString(16).slice(-6).toUpperCase()
992
1051
  while (hexColor.length < 6)
1052
+ {
993
1053
  hexColor = "0" + hexColor;
1054
+ }
994
1055
  hexColor = "#" + hexColor;
995
1056
  return hexColor;
996
1057
  }
@@ -1422,9 +1483,11 @@ class CodetextParameters extends joint.BaseJavaClass
1422
1483
  getColor()
1423
1484
  {
1424
1485
  let intColor = this.getJavaClass().getColorSync();
1425
- let hexColor = ((intColor)>>>0).toString(16).slice(-6).toUpperCase()
1486
+ let hexColor = ((intColor) >>> 0).toString(16).slice(-6).toUpperCase()
1426
1487
  while (hexColor.length < 6)
1488
+ {
1427
1489
  hexColor = "0" + hexColor;
1490
+ }
1428
1491
  hexColor = "#" + hexColor;
1429
1492
  return hexColor;
1430
1493
  }
@@ -1460,7 +1523,7 @@ class CodetextParameters extends joint.BaseJavaClass
1460
1523
  * Specify word wraps (line breaks) within text.<br>
1461
1524
  * Default value: false.
1462
1525
  */
1463
- getNoWrap()
1526
+ getNoWrap()
1464
1527
  {
1465
1528
  return this.getJavaClass().getNoWrapSync();
1466
1529
  }
@@ -2589,7 +2652,7 @@ class Pdf417Parameters extends joint.BaseJavaClass
2589
2652
  {
2590
2653
  this.getJavaClass().setPdf417MacroTimeStampSync((value.getTime() / 1000).toString());
2591
2654
  }
2592
-
2655
+
2593
2656
  /**
2594
2657
  * Gets macro Pdf417 barcode sender name.
2595
2658
  */
@@ -2597,7 +2660,7 @@ class Pdf417Parameters extends joint.BaseJavaClass
2597
2660
  {
2598
2661
  return this.getJavaClass().getPdf417MacroSenderSync();
2599
2662
  }
2600
-
2663
+
2601
2664
  /**
2602
2665
  * Sets macro Pdf417 barcode sender name.
2603
2666
  */
@@ -2605,7 +2668,7 @@ class Pdf417Parameters extends joint.BaseJavaClass
2605
2668
  {
2606
2669
  this.getJavaClass().setPdf417MacroSenderSync(value);
2607
2670
  }
2608
-
2671
+
2609
2672
  /**
2610
2673
  * Gets macro Pdf417 barcode addressee name.
2611
2674
  */
@@ -2613,7 +2676,7 @@ class Pdf417Parameters extends joint.BaseJavaClass
2613
2676
  {
2614
2677
  return this.getJavaClass().getPdf417MacroAddresseeSync();
2615
2678
  }
2616
-
2679
+
2617
2680
  /**
2618
2681
  * Sets macro Pdf417 barcode addressee name.
2619
2682
  */
@@ -2621,7 +2684,7 @@ class Pdf417Parameters extends joint.BaseJavaClass
2621
2684
  {
2622
2685
  this.getJavaClass().setPdf417MacroAddresseeSync(value);
2623
2686
  }
2624
-
2687
+
2625
2688
  /**
2626
2689
  * Gets or sets macro Pdf417 file size.<br>
2627
2690
  * @return The file size field contains the size in bytes of the entire source file.
@@ -2630,7 +2693,7 @@ class Pdf417Parameters extends joint.BaseJavaClass
2630
2693
  {
2631
2694
  return this.getJavaClass().getPdf417MacroFileSizeSync();
2632
2695
  }
2633
-
2696
+
2634
2697
  /**
2635
2698
  * Gets or sets macro Pdf417 file size.<br>
2636
2699
  * @param value The file size field contains the size in bytes of the entire source file.
@@ -2639,7 +2702,7 @@ class Pdf417Parameters extends joint.BaseJavaClass
2639
2702
  {
2640
2703
  this.getJavaClass().setPdf417MacroFileSizeSync(value);
2641
2704
  }
2642
-
2705
+
2643
2706
  /**
2644
2707
  * Gets macro Pdf417 barcode checksum.<br>
2645
2708
  * @return The checksum field contains the value of the 16-bit (2 bytes) CRC checksum using the CCITT-16 polynomial.
@@ -2648,7 +2711,7 @@ class Pdf417Parameters extends joint.BaseJavaClass
2648
2711
  {
2649
2712
  return this.getJavaClass().getPdf417MacroChecksumSync();
2650
2713
  }
2651
-
2714
+
2652
2715
  /**
2653
2716
  * Sets macro Pdf417 barcode checksum.<br>
2654
2717
  * @param value The checksum field contains the value of the 16-bit (2 bytes) CRC checksum using the CCITT-16 polynomial.
@@ -3198,19 +3261,6 @@ class ExtCodetextBuilder extends joint.BaseJavaClass
3198
3261
  this.init();
3199
3262
  }
3200
3263
 
3201
- /**
3202
- * <p>
3203
- * Checks necessity to shield previous item by "\000000"
3204
- * </p>
3205
- *
3206
- * @param Index Index in m_List
3207
- * @return Necessity to shield
3208
- */
3209
- isNeedToShieldItemFromPrevECI(Index)
3210
- {
3211
- return this.getJavaClass().isNeedToShieldItemFromPrevECISync(Index);
3212
- }
3213
-
3214
3264
  /**
3215
3265
  * <p>
3216
3266
  * Clears extended codetext items
@@ -3293,8 +3343,8 @@ class ExtCodetextBuilder extends joint.BaseJavaClass
3293
3343
  * lTextBuilder.addPlainCodetext("t\\e\\\\st");
3294
3344
  * //generate codetext
3295
3345
  * String lCodetext = lTextBuilder.getExtendedCodetext();
3296
- *
3297
- *
3346
+ *
3347
+ *
3298
3348
  */
3299
3349
  class QrExtCodetextBuilder extends ExtCodetextBuilder
3300
3350
  {
@@ -3463,9 +3513,9 @@ BarcodeClassifications =
3463
3513
  };
3464
3514
 
3465
3515
  /**
3466
- * FontStyle classification
3467
- * @enum
3468
- */
3516
+ * FontStyle classification
3517
+ * @enum
3518
+ */
3469
3519
  FontStyle =
3470
3520
  {
3471
3521
  BOLD: 1,
@@ -3477,6 +3527,7 @@ FontStyle =
3477
3527
 
3478
3528
  /**
3479
3529
  * Specifies the start or stop symbol of the Codabar barcode specification.
3530
+ * @enum
3480
3531
  */
3481
3532
  CodabarSymbol =
3482
3533
  {
@@ -4305,6 +4356,10 @@ GraphicsUnit =
4305
4356
  MILLIMETER: 6,
4306
4357
  };
4307
4358
 
4359
+ /**
4360
+ * Specifies the type of barcode to encode.
4361
+ * @enum
4362
+ */
4308
4363
  EncodeTypes =
4309
4364
  {
4310
4365
 
@@ -4554,6 +4609,11 @@ EncodeTypes =
4554
4609
  */
4555
4610
  RM_4_SCC: 42,
4556
4611
 
4612
+ /**
4613
+ * Represents Royal Mail Mailmark barcode.
4614
+ */
4615
+ MAILMARK: 66,
4616
+
4557
4617
  /**
4558
4618
  * Specifies that the data should be encoded with GS1 Databar omni-directional barcode specification.
4559
4619
  */
@@ -4656,35 +4716,35 @@ EncodeTypes =
4656
4716
  *@enum
4657
4717
  */
4658
4718
  MacroCharacter =
4659
- {
4660
- /**
4661
- * None of Macro Characters are added to barcode data
4662
- */
4663
- NONE: 0,
4719
+ {
4720
+ /**
4721
+ * None of Macro Characters are added to barcode data
4722
+ */
4723
+ NONE: 0,
4664
4724
 
4665
- /**
4666
- * 05 Macro craracter is added to barcode data in first position.
4667
- * GS1 Data Identifier ISO 15434
4668
- * Character is translated to "[)>\u001E05\u001D" as decoded data header and "\u001E\u0004" as decoded data trailer.
4669
- *
4670
- * //to generate autoidentified GS1 message like this "(10)123ABC(10)123ABC" in ISO 15434 format you need:
4671
- * let generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX, "10123ABC\u001D10123ABC");
4672
- * generator.getParameters().getBarcode().getDataMatrix().setMacroCharacters(MacroCharacter.MACRO_05);
4673
- * let reader = new BarCodeReader(generator.generateBarCodeImage(), DecodeType.GS_1_DATA_MATRIX);
4674
- * reader.readBarCodes().forEach(function(result, i, results)
4675
- * {
4676
- * cosole.log("BarCode CodeText: " + result.getCodeText());
4677
- * });
4678
- */
4679
- MACRO_05: 5,
4725
+ /**
4726
+ * 05 Macro craracter is added to barcode data in first position.
4727
+ * GS1 Data Identifier ISO 15434
4728
+ * Character is translated to "[)>\u001E05\u001D" as decoded data header and "\u001E\u0004" as decoded data trailer.
4729
+ *
4730
+ * //to generate autoidentified GS1 message like this "(10)123ABC(10)123ABC" in ISO 15434 format you need:
4731
+ * let generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX, "10123ABC\u001D10123ABC");
4732
+ * generator.getParameters().getBarcode().getDataMatrix().setMacroCharacters(MacroCharacter.MACRO_05);
4733
+ * let reader = new BarCodeReader(generator.generateBarCodeImage(), DecodeType.GS_1_DATA_MATRIX);
4734
+ * reader.readBarCodes().forEach(function(result, i, results)
4735
+ * {
4736
+ * cosole.log("BarCode CodeText: " + result.getCodeText());
4737
+ * });
4738
+ */
4739
+ MACRO_05: 5,
4680
4740
 
4681
- /**
4682
- * 06 Macro craracter is added to barcode data in first position.
4683
- * ASC MH10 Data Identifier ISO 15434
4684
- * Character is translated to "[)>\u001E06\u001D" as decoded data header and "\u001E\u0004" as decoded data trailer.
4685
- */
4686
- MACRO_06: 6
4687
- };
4741
+ /**
4742
+ * 06 Macro craracter is added to barcode data in first position.
4743
+ * ASC MH10 Data Identifier ISO 15434
4744
+ * Character is translated to "[)>\u001E06\u001D" as decoded data header and "\u001E\u0004" as decoded data trailer.
4745
+ */
4746
+ MACRO_06: 6
4747
+ };
4688
4748
 
4689
4749
  /**
4690
4750
  * PatchCode format. Choose PatchOnly to generate single PatchCode. Use page format to generate Patch page with PatchCodes as borders
@@ -4731,7 +4791,7 @@ PatchFormat =
4731
4791
  * generator.getParameters().getBarcode().getQR().setQrECIEncoding(ECIEncodings.UTF_8);
4732
4792
  * generator.save("test.png", BarCodeImageFormat.PNG);
4733
4793
  *
4734
- * @enum
4794
+ * @enum
4735
4795
  */
4736
4796
  ECIEncodings =
4737
4797
  {
@@ -4887,27 +4947,27 @@ EnableChecksum =
4887
4947
  * @enum
4888
4948
  */
4889
4949
  Code128Emulation =
4890
- {
4891
- /**
4892
- * No Code 128 emulation
4893
- */
4894
- NONE: 0,
4950
+ {
4951
+ /**
4952
+ * No Code 128 emulation
4953
+ */
4954
+ NONE: 0,
4895
4955
 
4896
- /**
4897
- * UCC/EAN-128 emulation. Text compactionmode implied.
4898
- */
4899
- CODE_903: 903,
4956
+ /**
4957
+ * UCC/EAN-128 emulation. Text compactionmode implied.
4958
+ */
4959
+ CODE_903: 903,
4900
4960
 
4901
- /**
4902
- * UCC/EAN-128 emulation. Numeric compactionmode implied.
4903
- */
4904
- CODE_904: 904,
4961
+ /**
4962
+ * UCC/EAN-128 emulation. Numeric compactionmode implied.
4963
+ */
4964
+ CODE_904: 904,
4905
4965
 
4906
- /**
4907
- * UCC/EAN-128 emulation. Implied “01” AI and 14-digit codetext.
4908
- */
4909
- CODE_905: 905
4910
- }
4966
+ /**
4967
+ * UCC/EAN-128 emulation. Implied “01” AI and 14-digit codetext.
4968
+ */
4969
+ CODE_905: 905
4970
+ }
4911
4971
 
4912
4972
  /**
4913
4973
  * Specifies the file format of the image.
@@ -4916,32 +4976,45 @@ Code128Emulation =
4916
4976
  BarCodeImageFormat =
4917
4977
  {
4918
4978
  /**
4919
- * <p>
4920
- * Specifies the W3C Portable Network Graphics (PNG) image format.
4921
- * </p>
4979
+ * Specifies the bitmap (BMP) image format.
4922
4980
  */
4923
- BMP: 0,
4981
+ BMP:0,
4982
+
4983
+ /**
4984
+ * Specifies the Graphics Interchange Format (GIF) image format.
4985
+ */
4986
+ GIF:1,
4924
4987
 
4925
4988
  /**
4926
- * <p>
4927
4989
  * Specifies the Joint Photographic Experts Group (JPEG) image format.
4928
- * </p>
4929
4990
  */
4930
- GIF: 1,
4991
+ JPEG:2,
4931
4992
 
4932
4993
  /**
4933
- * <p>
4934
- * Specifies the bitmap (BMP) image format.
4935
- * </p>
4994
+ * Specifies the W3C Portable Network Graphics (PNG) image format.
4936
4995
  */
4937
- JPEG: 2,
4996
+ PNG:3,
4938
4997
 
4939
4998
  /**
4940
- * <p>
4941
- * Specifies the Graphics Interchange Format (GIF) image format.
4942
- * </p>
4999
+ * Specifies the Tagged Image File Format (TIFF) image format.
5000
+ */
5001
+ TIFF:4,
5002
+
5003
+
5004
+ /**
5005
+ * Specifies the Tagged Image File Format (TIFF) image format in CMYK color model.
5006
+ */
5007
+ TIFF_IN_CMYK:5,
5008
+
5009
+ /**
5010
+ * Specifies the Enhanced Metafile (EMF) image format.
5011
+ */
5012
+ EMF:6,
5013
+
5014
+ /**
5015
+ * Specifies the Scalable Vector Graphics (SVG) image format.
4943
5016
  */
4944
- PNG: 3
5017
+ SVG:7
4945
5018
  };
4946
5019
 
4947
5020
  module.exports = {
package/lib/Joint.js CHANGED
@@ -1,6 +1,35 @@
1
1
  const java = require('java');
2
2
  const fs = require("fs");
3
3
 
4
+
5
+ function isPath(image)
6
+ {
7
+ if (image.length < 256 && image.includes("/") || image.includes("\\"))
8
+ {
9
+ if (fs.existsSync(image))
10
+ {
11
+ return true;
12
+ }
13
+ throw new joint.BarcodeException("Path " + image + " does not exist");
14
+ }
15
+ return false;
16
+ }
17
+
18
+ function convertResourceToBase64String(resource)
19
+ {
20
+ let is_path_to_image = false;
21
+ is_path_to_image = fs.existsSync(resource);
22
+
23
+ if (is_path_to_image)
24
+ {
25
+ return fs.readFileSync(resource).toString('base64');
26
+ }
27
+ else
28
+ {
29
+ return resource;
30
+ }
31
+ }
32
+
4
33
  class BaseJavaClass
5
34
  {
6
35
  javaClass;
@@ -406,5 +435,5 @@ class BuildVersionInfo
406
435
  }
407
436
 
408
437
  module.exports = {
409
- BaseJavaClass, BarcodeException, Rectangle, Point, License, BuildVersionInfo
438
+ BaseJavaClass, BarcodeException, Rectangle, Point, License, BuildVersionInfo, isPath, convertResourceToBase64String
410
439
  };
@@ -34,9 +34,9 @@ class BarCodeReader extends joint.BaseJavaClass
34
34
  {
35
35
  if(image != null)
36
36
  {
37
- if (BarCodeReader.isPath(image))
37
+ if (joint.isPath(image))
38
38
  {
39
- image = BarCodeReader.loadImage(image);
39
+ image = joint.convertResourceToBase64String(image);
40
40
  }
41
41
  }
42
42
  if (rectangles != null)
@@ -88,19 +88,6 @@ class BarCodeReader extends joint.BaseJavaClass
88
88
  return barcodeReader;
89
89
  }
90
90
 
91
- static isPath(image)
92
- {
93
- if (image.length < 256 && image.includes("/") || image.includes("\\"))
94
- {
95
- if (fs.existsSync(image))
96
- {
97
- return true;
98
- }
99
- throw new joint.BarcodeException("Path " + image + " does not exist");
100
- }
101
- return false;
102
- }
103
-
104
91
  /**
105
92
  * Determines whether any of the given decode types is included into<br>
106
93
  * @param ...decodeTypes Types to verify.
@@ -115,21 +102,6 @@ class BarCodeReader extends joint.BaseJavaClass
115
102
  return this.getJavaClass().containsAnySync(decodeTypes);
116
103
  }
117
104
 
118
- static loadImage(image)
119
- {
120
- let is_path_to_image = false;
121
- is_path_to_image = fs.existsSync(image);
122
-
123
- if (is_path_to_image)
124
- {
125
- return fs.readFileSync(image).toString('base64');
126
- }
127
- else
128
- {
129
- return image;
130
- }
131
- }
132
-
133
105
  static convertToString(arg)
134
106
  {
135
107
  if (is_int(arg))
@@ -585,7 +557,7 @@ class BarCodeReader extends joint.BaseJavaClass
585
557
  */
586
558
  setBarCodeImage(image, ...areas)
587
559
  {
588
- image = BarCodeReader.loadImage(image);
560
+ image = joint.convertResourceToBase64String(image);
589
561
  let stringAreas = [];
590
562
  let isAllRectanglesNotNull = false;
591
563
  if (!(areas == null) && areas.length > 0)
@@ -644,7 +616,7 @@ class BarCodeReader extends joint.BaseJavaClass
644
616
 
645
617
  /**
646
618
  * Exports BarCode properties to the xml-file specified
647
- * @param xmlFile The name for the file
619
+ * @param xmlFile The name of the file
648
620
  * @return Whether or not export completed successfully.
649
621
  * Returns True in case of success; False Otherwise
650
622
  */
@@ -667,7 +639,7 @@ class BarCodeReader extends joint.BaseJavaClass
667
639
 
668
640
  /**
669
641
  * Exports BarCode properties to the xml-file specified
670
- * @param xmlFile The name for the file
642
+ * @param xmlFile The name of the file
671
643
  * @return Whether or not export completed successfully. Returns True in case of success; False Otherwise
672
644
  */
673
645
  static importFromXml(xmlFile)
@@ -3240,6 +3212,10 @@ DecodeType =
3240
3212
  * Specifies that the data should be decoded with {@code <b>CodablockF</b>} barcode specification
3241
3213
  */
3242
3214
  CODABLOCK_F: 65,
3215
+ /**
3216
+ * Specifies that the data should be decoded with <b>Royal Mail Mailmark</b> barcode specification.
3217
+ */
3218
+ MAILMARK: 66,
3243
3219
 
3244
3220
  /**
3245
3221
  * Specifies that the data should be decoded with {@code <b>Australia Post</b>} barcode specification
@@ -3384,7 +3360,7 @@ DecodeType =
3384
3360
  /**
3385
3361
  * Specifies that data will be checked with all available symbologies
3386
3362
  */
3387
- ALL_SUPPORTED_TYPES: 66,
3363
+ ALL_SUPPORTED_TYPES: 71,
3388
3364
 
3389
3365
  /**
3390
3366
  * Specifies that data will be checked with all of 1D barcode symbologies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aspose.barcode",
3
- "version": "21.10.5",
3
+ "version": "22.1.5",
4
4
  "description": "barcode generation and recognition component",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"