aspose.barcode 24.8.0 → 24.10.2

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.
@@ -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.8.jar";
7
+ const jar_name_ = "/aspose-barcode-nodejs-24.10.jar";
8
8
  const jar_path_ = __dirname + jar_name_;
9
9
  const fs = require("fs");
10
10
 
@@ -1020,7 +1020,9 @@ class MailmarkCodetext extends IComplexCodetext
1020
1020
  * "9" - Standard (Network Access)<br>
1021
1021
  */
1022
1022
  getClass_()
1023
- { return this.getJavaClass().getClass_Sync(); }
1023
+ {
1024
+ return this.getJavaClass().getClass_Sync();
1025
+ }
1024
1026
 
1025
1027
  /**
1026
1028
  * "0" - Null or Test<br>
@@ -1034,8 +1036,10 @@ class MailmarkCodetext extends IComplexCodetext
1034
1036
  * "8" - Premium (Network Access)<br>
1035
1037
  * "9" - Standard (Network Access)
1036
1038
  */
1037
- setClass(value)
1038
- { this.getJavaClass().setClassSync(value); }
1039
+ setClass_(value)
1040
+ {
1041
+ this.getJavaClass().setClassSync(value);
1042
+ }
1039
1043
 
1040
1044
  /**
1041
1045
  * Maximum values are 99 for Barcode C and 999999 for Barcode L.
@@ -1237,9 +1241,9 @@ class Mailmark2DCodetext extends IComplexCodetext
1237
1241
  *
1238
1242
  * @return class of the item
1239
1243
  */
1240
- getclass()
1244
+ getClass_()
1241
1245
  {
1242
- return this.getJavaClass().getclassSync();
1246
+ return this.getJavaClass().getClass_Sync();
1243
1247
  }
1244
1248
 
1245
1249
  /**
@@ -1255,7 +1259,7 @@ class Mailmark2DCodetext extends IComplexCodetext
1255
1259
  *
1256
1260
  * @param value class of the item
1257
1261
  */
1258
- setclass(value)
1262
+ setClass_(value)
1259
1263
  {
1260
1264
  this.getJavaClass().setclassSync(value);
1261
1265
  }
@@ -1631,7 +1635,7 @@ class MaxiCodeStandardCodetext extends MaxiCodeCodetext
1631
1635
  }
1632
1636
  catch (ex)
1633
1637
  {
1634
- throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
1638
+ throw new BarcodeException(ex);
1635
1639
  }
1636
1640
  }
1637
1641
 
@@ -1735,7 +1739,7 @@ class MaxiCodeStandartSecondMessage extends MaxiCodeSecondMessage
1735
1739
  }
1736
1740
  catch (ex)
1737
1741
  {
1738
- throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
1742
+ throw new BarcodeException(ex);
1739
1743
  }
1740
1744
  }
1741
1745
 
@@ -1812,7 +1816,7 @@ class MaxiCodeStructuredCodetext extends MaxiCodeCodetext
1812
1816
  }
1813
1817
  catch (ex)
1814
1818
  {
1815
- throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
1819
+ throw new BarcodeException(ex);
1816
1820
  }
1817
1821
  }
1818
1822
 
@@ -2025,7 +2029,7 @@ class MaxiCodeCodetextMode2 extends MaxiCodeStructuredCodetext
2025
2029
  }
2026
2030
  catch (ex)
2027
2031
  {
2028
- throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
2032
+ throw new BarcodeException(ex);
2029
2033
  }
2030
2034
  }
2031
2035
 
@@ -2140,7 +2144,7 @@ class MaxiCodeCodetextMode3 extends MaxiCodeStructuredCodetext
2140
2144
  }
2141
2145
  catch (ex)
2142
2146
  {
2143
- throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
2147
+ throw new BarcodeException(ex);
2144
2148
  }
2145
2149
  }
2146
2150
 
@@ -2183,7 +2187,7 @@ class MaxiCodeStructuredSecondMessage extends MaxiCodeSecondMessage
2183
2187
  }
2184
2188
  catch (ex)
2185
2189
  {
2186
- throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
2190
+ throw new BarcodeException(ex);
2187
2191
  }
2188
2192
  }
2189
2193
 
package/lib/Generation.js CHANGED
@@ -47,7 +47,7 @@ class BarcodeGenerator extends joint.BaseJavaClass
47
47
 
48
48
  static construct(javaClass)
49
49
  {
50
- let barcodeGenerator = new BarcodeGenerator(null, null);
50
+ let barcodeGenerator = new BarcodeGenerator(0, "");
51
51
  barcodeGenerator.setJavaClass(javaClass);
52
52
  return barcodeGenerator;
53
53
  }
@@ -154,11 +154,11 @@ class BarcodeGenerator extends joint.BaseJavaClass
154
154
  let xmlData = this.getJavaClass().exportToXmlSync();
155
155
  let isSaved = xmlData != null;
156
156
  if (isSaved) {
157
- fs.writeFileSync(filePath, xmlData);
157
+ fs.writeFileSync(filePath, Buffer.from(xmlData, 'base64').toString('utf-8'));
158
158
  }
159
159
  return isSaved;
160
160
  } catch (ex) {
161
- throw new BarcodeException(ex.getMessage());
161
+ throw new joint.BarcodeException(ex);
162
162
  }
163
163
  }
164
164
 
@@ -169,15 +169,16 @@ class BarcodeGenerator extends joint.BaseJavaClass
169
169
  * @return BarcodeGenerator instance
170
170
  * @param filePath The name of the file
171
171
  */
172
- importFromXml(filePath)
172
+ static importFromXml(filePath)
173
173
  {
174
174
  try {
175
- let xmlData = joint.convertResourceToBase64String(filePath);
176
- let offset = 6;
177
- xmlData = xmlData.substr(offset);
178
- return BarcodeGenerator.construct(java(BarcodeGenerator.javaClassName).importFromXmlSync(xmlData));
175
+ let xmlData = joint.convertImageResourceToBase64(filePath);
176
+ // let offset = 6;
177
+ // xmlData = xmlData.substr(offset);
178
+ let java_class_link = java.import(BarcodeGenerator.javaClassName);
179
+ return BarcodeGenerator.construct(java_class_link.importFromXmlSync(xmlData));
179
180
  } catch (ex) {
180
- throw new BarcodeException(ex.getMessage());
181
+ throw new joint.BarcodeException(ex);
181
182
  }
182
183
  }
183
184
  }
@@ -910,15 +911,6 @@ class BaseGenerationParameters extends joint.BaseJavaClass
910
911
  return this.barcodeParameters;
911
912
  }
912
913
 
913
- /**
914
- * Gets the BarcodeParameters that contains all barcode properties.
915
- */
916
- setBarcode(value)
917
- {
918
- this.getJavaClass().setBarcodeSync(value.getJavaClass());
919
- this.barcodeParameters = value;
920
- }
921
-
922
914
  /**
923
915
  * Gets the BorderParameters that contains all configuration properties for barcode border.
924
916
  */
@@ -4541,7 +4533,7 @@ class MaxiCodeExtCodetextBuilder extends ExtCodetextBuilder
4541
4533
  let java_class = java.import(MaxiCodeExtCodetextBuilder.JAVA_CLASS_NAME);
4542
4534
  super(new java_class());
4543
4535
  } catch (ex) {
4544
- throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
4536
+ throw new joint.BarcodeException(ex);
4545
4537
  }
4546
4538
  }
4547
4539
 
package/lib/Joint.js CHANGED
@@ -229,68 +229,55 @@ class License extends BaseJavaClass
229
229
  }
230
230
 
231
231
  /**
232
- * Class BarcodeException
232
+ * @class
233
+ * @extends {Error}
233
234
  */
234
- class BarcodeException extends Error
235
- {
236
- static get MAX_LINES()
237
- {
238
- return 4;
239
- };
240
-
235
+ class BarcodeException extends Error {
241
236
  /**
242
- * BarcodeException constructor.
243
- * @param exc exception's instance
237
+ * Constructor of BarcodeException.
238
+ * @param {Error|string} exc - Exception or error message
244
239
  */
245
- constructor(exc)
246
- {
247
- super();
248
- if ((typeof exc.toString()) === 'string')
249
- {
250
- this.setMessage(exc.toString());
251
- return;
240
+ constructor(exc) {
241
+ let message = '';
242
+
243
+ if (exc instanceof Error) {
244
+ message = exc.message;
245
+ } else if (typeof exc === 'string') {
246
+ message = exc;
247
+ } else {
248
+ message = 'An unknown error occurred.';
252
249
  }
253
- let exc_message = "Exception occured in file:line" + nl;
254
250
 
255
- this.setMessage(exc_message);
256
- }
257
-
258
- getDetails(exc)
259
- {
260
- let details = "";
261
- if (typeof exc === 'string' || exc instanceof String)
262
- {
263
- return exc;
264
- }
265
- if (get_class(exc) != null)
266
- {
267
- details = "exception type : " + get_class(exc) + "\n";
268
- }
269
- if (method_exists(exc, "__toString"))
270
- {
271
- details += exc.__toString();
272
- }
273
- if (method_exists(exc, "getMessage"))
274
- {
275
- details += exc.getMessage();
276
- }
277
- if (method_exists(exc, "getCause"))
278
- {
279
- details += exc.getCause();
280
- }
281
- return details;
251
+ super(message);
252
+ this.name = 'BarcodeException';
282
253
  }
283
254
 
284
255
  /**
285
- * @param mixed message
256
+ * Gets the exception details.
257
+ * @param {Error|string} exc - The exception or error message.
258
+ * @returns {string} The exception details.
286
259
  */
287
- setMessage(message)
288
- {
289
- this.message = message;
290
- }
260
+ getDetails(exc) {
261
+ let details = '';
291
262
 
263
+ if (exc instanceof Error) {
264
+ details += `Exception type: ${exc.constructor.name}\n`;
265
+ details += `Message: ${exc.message}\n`;
266
+
267
+ if (typeof exc.stack === 'string') {
268
+ details += `Stack trace:\n${exc.stack}`;
269
+ }
270
+ } else if (typeof exc === 'string') {
271
+ details = exc;
272
+ } else {
273
+ details = 'No additional details available.';
274
+ }
275
+
276
+ return details;
277
+ }
292
278
  }
293
279
 
280
+
294
281
  class Rectangle extends BaseJavaClass
295
282
  {
296
283
 
@@ -688,6 +688,35 @@ class QRExtendedParameters extends joint.BaseJavaClass
688
688
  {
689
689
  return this.getJavaClass().getQRStructuredAppendModeParityDataSync();
690
690
  }
691
+
692
+ /**
693
+ * Version of recognized QR Code. From Version1 to Version40.
694
+ * @return Version of recognized QR Code
695
+ */
696
+ getQRVersion()
697
+ { return this.getJavaClass().getQRVersionSync(); }
698
+
699
+ /**
700
+ * Version of recognized MicroQR Code. From M1 to M4.
701
+ * @return Version of recognized MicroQR Code. From M1 to M4.
702
+ */
703
+ getMicroQRVersion()
704
+ { return this.getJavaClass().getMicroQRVersionSync(); }
705
+
706
+ /**
707
+ * Version of recognized RectMicroQR Code. From R7x43 to R17x139.
708
+ * @return Version of recognized RectMicroQR Code
709
+ */
710
+ getRectMicroQRVersion()
711
+ { return this.getJavaClass().getRectMicroQRVersionSync(); }
712
+
713
+ /**
714
+ * Reed-Solomon error correction level of recognized barcode. From low to high: LevelL, LevelM, LevelQ, LevelH.
715
+ * @return Reed-Solomon error correction level of recognized barcode.
716
+ */
717
+ getQRErrorLevel()
718
+ {return this.getJavaClass().getQRErrorLevelSync(); }
719
+
691
720
  /**
692
721
  * <p>Tests whether all parameters has only default values</p>Value
693
722
  * @returns <b>true</b> if all parameters has only default values; otherwise, {@code <b>false</b>}.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aspose.barcode",
3
- "version": "24.8.0",
3
+ "version": "24.10.2",
4
4
  "description": "barcode generation and recognition component",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"