Recognition.js

  1. const fs = require("fs");
  2. const java = require('java');
  3. const joint = require("./Joint");
  4. const {Rectangle} = require("./Joint");
  5. /**
  6. * BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform ReadBarCodes operation to detect barcodes.
  7. * @example
  8. * //This sample shows how to detect Code39 and Code128 barcodes.
  9. * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39, DecodeType.CODE_128]);
  10. * reader.readBarCodes().forEach(function(result, i, results)
  11. * {
  12. * console.log("BarCode Type: " + result.getCodeTypeName());
  13. * console.log("BarCode CodeText: " + result.getCodeText());
  14. * });
  15. */
  16. class BarCodeReader extends joint.BaseJavaClass
  17. {
  18. qualitySettings;
  19. recognizedResults;
  20. barcodeSettings;
  21. static get javaClassName()
  22. {
  23. return "com.aspose.mw.barcode.recognition.MwBarCodeReader";
  24. }
  25. /**
  26. * Initializes a new instance of the BarCodeReader<br>
  27. * @param image encoded as base64 string or path to image
  28. * @param rectangles array of object by type Rectangle
  29. * @param decodeTypes the array of objects by DecodeType
  30. */
  31. constructor(image, areas, decodeTypes)
  32. {
  33. try
  34. {
  35. let stringFormattedAreas = joint.convertAreasToStringFormattedAreas(areas);
  36. let decodeTypesArray = joint.convertDecodeTypeToFormattedDecodeType(decodeTypes);
  37. let base64Image = joint.convertImageResourceToBase64(image);
  38. let java_class_link = new java.import(BarCodeReader.javaClassName);
  39. let java_class = new java_class_link(base64Image, stringFormattedAreas, decodeTypesArray);
  40. super(java_class);
  41. this.init()
  42. }
  43. catch (e)
  44. {
  45. console.error("Invalid arguments");
  46. throw e;
  47. }
  48. }
  49. static construct(javaClass)
  50. {
  51. let barcodeReader = new BarCodeReader(null, null, null);
  52. barcodeReader.setJavaClass(javaClass);
  53. return barcodeReader;
  54. }
  55. /**
  56. * Determines whether any of the given decode types is included into<br>
  57. * @param ...decodeTypes Types to verify.
  58. * @return bool Value is a true if any types are included into.
  59. */
  60. containsAny(...decodeTypes)
  61. {
  62. for (let i = 0; i < decodeTypes.length; i++)
  63. {
  64. decodeTypes[i] = decodeTypes[i] + "";
  65. }
  66. return this.getJavaClass().containsAnySync(decodeTypes);
  67. }
  68. /**
  69. * internal
  70. */
  71. static convertToString(arg)
  72. {
  73. if (is_int(arg))
  74. {
  75. return strval(arg);
  76. }
  77. else if (arg instanceof Rectangle)
  78. {
  79. return "{[" + arg.toString() + "]}";
  80. }
  81. else if (is_array(arg))
  82. {
  83. let areasString = "{";
  84. for (let i = 0; i < sizeof(arg); i++)
  85. {
  86. areasString += "[" + arg[i].toString() + "]";
  87. }
  88. areasString += "}";
  89. return areasString;
  90. }
  91. else
  92. {
  93. return arg;
  94. }
  95. }
  96. init()
  97. {
  98. this.qualitySettings = new QualitySettings(this.getJavaClass().getQualitySettingsSync());
  99. this.barcodeSettings = new BarcodeSettings(this.getJavaClass().getBarcodeSettingsSync());
  100. }
  101. /**
  102. * Gets the timeout of recognition process in milliseconds.<br>
  103. * @example
  104. * let reader = new BarCodeReader("test.png", null, null);
  105. * reader.setTimeout(5000);
  106. * reader.readBarCodes().forEach(function(result, i, results)
  107. * {
  108. * console.log("BarCode CodeText: " + result.getCodeText());
  109. * });
  110. * @return The timeout.
  111. */
  112. getTimeout()
  113. {
  114. return this.getJavaClass().getTimeoutSync();
  115. }
  116. /**
  117. * Sets the timeout of recognition process in milliseconds.
  118. *@example
  119. * let reader = new BarCodeReader("test.png", null, null);
  120. * reader.setTimeout(5000);
  121. * reader.readBarCodes().forEach(function(result, i, results)
  122. * {
  123. * console.log("BarCode CodeText: " + result.getCodeText());
  124. * });
  125. * @param value The timeout.
  126. */
  127. setTimeout(value)
  128. {
  129. this.getJavaClass().setTimeoutSync(value);
  130. }
  131. abort()
  132. {
  133. this.getJavaClass().abortSync();
  134. }
  135. /**
  136. * Gets recognized BarCodeResult array
  137. * @example
  138. * //This sample shows how to read barcodes with BarCodeReader
  139. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  140. * reader.readBarCodes();
  141. * for(let i = 0; reader.getFoundCount() > i; ++i)
  142. * console.log("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText());
  143. *
  144. * @return recognized BarCodeResult array
  145. */
  146. getFoundBarCodes()
  147. {
  148. return this.recognizedResults;
  149. }
  150. /**
  151. * Gets recognized barcodes count
  152. * @example
  153. * //This sample shows how to read barcodes with BarCodeReader
  154. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  155. * reader.readBarCodes();
  156. * for(let i = 0; reader.getFoundCount() > i; ++i)
  157. * console.log("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText());
  158. * Value: The recognized barcodes count
  159. */
  160. getFoundCount()
  161. {
  162. return this.getJavaClass().getFoundCountSync();
  163. }
  164. /**
  165. * Reads BarCodeResult from the image.
  166. * @example
  167. * //This sample shows how to read barcodes with BarCodeReader
  168. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  169. * reader.readBarCodes().forEach(function(result, i, results)
  170. * {
  171. * console.log("BarCode CodeText: " + result.getCodeText());
  172. * });
  173. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  174. * reader.readBarCodes();
  175. * for(let i = 0; reader.getFoundCount() > i; ++i)
  176. * console.log("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText());
  177. * @return Returns array of recognized {@code BarCodeResult}s on the image. If nothing is recognized, zero array is returned.
  178. */
  179. readBarCodes()
  180. {
  181. try
  182. {
  183. this.recognizedResults = [];
  184. let javaReadBarcodes = this.getJavaClass().readBarCodesSync();
  185. for (let i = 0; i < javaReadBarcodes.length; i++)
  186. {
  187. this.recognizedResults[i] = new BarCodeResult(javaReadBarcodes[i]);
  188. }
  189. return this.recognizedResults;
  190. } catch (e)
  191. {
  192. if ((e.toString().includes("RecognitionAbortedException")))
  193. {
  194. throw new RecognitionAbortedException(e.toString(), null);
  195. }
  196. throw e;
  197. }
  198. }
  199. /**
  200. * QualitySettings allows to configure recognition quality and speed manually.<br>
  201. * You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality,<br>
  202. * HighQuality, MaxBarCodes or you can manually configure separate options.<br>
  203. * Default value of QualitySettings is NormalQuality.<br>
  204. * @return QualitySettings to configure recognition quality and speed.
  205. *
  206. * @example
  207. * //This sample shows how to use QualitySettings with BarCodeReader
  208. *
  209. * let reader = new BarCodeReader("test.png", null, null);
  210. * //set high performance mode
  211. * reader.setQualitySettings(QualitySettings.getHighPerformance());
  212. * reader.readBarCodes().forEach(function(result, i, results)
  213. * {
  214. * console.log("BarCode CodeText: " + result.getCodeText());
  215. * });
  216. *
  217. * @example
  218. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  219. * //normal quality mode is set by default
  220. * reader.readBarCodes().forEach(function(result, i, results)
  221. * {
  222. * console.log("BarCode CodeText: " + result.getCodeText());
  223. * });
  224. *
  225. * @example
  226. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  227. * //set high performance mode
  228. * reader.setQualitySettings(QualitySettings.getHighPerformance());
  229. * //set separate options
  230. * reader.getQualitySettings().setAllowMedianSmoothing(true);
  231. * reader.getQualitySettings().setMedianSmoothingWindowSize(5);
  232. * reader.readBarCodes().forEach(function(result, i, results)
  233. * {
  234. * console.log("BarCode CodeText: " + result.getCodeText());
  235. * });
  236. */
  237. getQualitySettings()
  238. {
  239. return this.qualitySettings;
  240. }
  241. /**
  242. * QualitySettings allows to configure recognition quality and speed manually.<br>
  243. * You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality,<br>
  244. * HighQuality, MaxBarCodes or you can manually configure separate options.<br>
  245. * Default value of QualitySettings is NormalQuality.
  246. *
  247. * @example
  248. * //This sample shows how to use QualitySettings with BarCodeReader
  249. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  250. * //set high performance mode
  251. * reader.setQualitySettings(QualitySettings.getHighPerformance());
  252. * reader.readBarCodes().forEach(function(result, i, results)
  253. * {
  254. * console.log("BarCode CodeText: " + result.getCodeText());
  255. * });
  256. * @example
  257. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  258. * //normal quality mode is set by default
  259. * reader.readBarCodes().forEach(function(result, i, results)
  260. * {
  261. * console.log("BarCode CodeText: " + result.getCodeText());
  262. * });
  263. * @example
  264. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  265. * //set high performance mode
  266. * reader.setQualitySettings(QualitySettings.getHighPerformance());
  267. * //set separate options
  268. * reader.getQualitySettings().setAllowMedianSmoothing(true);
  269. * reader.getQualitySettings().setMedianSmoothingWindowSize(5);
  270. * reader.readBarCodes().forEach(function(result, i, results)
  271. * {
  272. * console.log("BarCode CodeText: " + result.getCodeText());
  273. * });
  274. * QualitySettings to configure recognition quality and speed.
  275. */
  276. setQualitySettings(value)
  277. {
  278. this.getJavaClass().setQualitySettingsSync(value.getJavaClass());
  279. }
  280. /**
  281. * The main BarCode decoding parameters. Contains parameters which make influence on recognized data.
  282. * @return The main BarCode decoding parameters
  283. */
  284. getBarcodeSettings()
  285. {
  286. return this.barcodeSettings;
  287. }
  288. /**
  289. * Sets bitmap image and areas for recognition.<br>
  290. * Must be called before ReadBarCodes() method.
  291. * @example
  292. * //This sample shows how to detect Code39 and Code128 barcodes.
  293. * let bmp = "test.png";
  294. * let reader = new BarCodeReader();
  295. * reader.setBarCodeReadType([ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  296. * var img = new Image();
  297. * img.src = 'path_to_image';
  298. * width = img.width;
  299. * height = img.height;
  300. * reader.setBarCodeImage(bmp, new Rectangle[] { new Rectangle(0, 0, width, height) });
  301. * reader.readBarCodes().forEach(function(result, i, results)
  302. * {
  303. * console.log("BarCode Type: " + result.getCodeTypeName());
  304. * console.log("BarCode CodeText: " + result.getCodeText());
  305. * });
  306. * @param imageResource The image for recognition.
  307. * @param areas areas list for recognition
  308. * @throws BarcodeException
  309. */
  310. setBarCodeImage(imageResource, ...areas)
  311. {
  312. let base64Image = joint.convertImageResourceToBase64(imageResource);
  313. let stringFormattedAreas = joint.convertAreasToStringFormattedAreas(areas);
  314. this.getJavaClass().setBarCodeImageSync(base64Image, stringFormattedAreas);
  315. }
  316. /**
  317. * Sets SingleDecodeType type array for recognition.<br>
  318. * Must be called before readBarCodes() method.
  319. * @example
  320. * //This sample shows how to detect Code39 and Code128 barcodes.
  321. * let reader = new BarCodeReader();
  322. * reader.setBarCodeReadType([ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  323. * reader.setBarCodeImage("test.png");
  324. * reader.readBarCodes().forEach(function(result, i, results)
  325. * {
  326. * console.log("BarCode Type: " + result.getCodeTypeName());
  327. * console.log("BarCode CodeText: " + result.getCodeText());
  328. * });
  329. * @param types The SingleDecodeType type array to read.
  330. */
  331. setBarCodeReadType(...types)
  332. {
  333. for (let i = 0; i < types.length; i++)
  334. {
  335. types[i] = types[i] + "";
  336. }
  337. this.getJavaClass().setBarCodeReadTypeSync(types);
  338. }
  339. /**
  340. * Gets the decode type of the input barcode decoding
  341. * @returns {*}
  342. */
  343. getBarCodeDecodeType()
  344. {
  345. let barcodeTypesArray = [];
  346. let javaDecodeTypes = this.getJavaClass().getBarCodeDecodeTypeSync();
  347. for(let i = 0; i < javaDecodeTypes.sizeSync(); i++)
  348. {
  349. barcodeTypesArray.push(javaDecodeTypes.getSync(i));
  350. }
  351. return barcodeTypesArray;
  352. }
  353. /**
  354. * Exports BarCode properties to the xml-file specified<br>
  355. * @param xmlFile The name of the file<br>
  356. * @return Whether or not export completed successfully.<br>
  357. * Returns True in case of success; False Otherwise
  358. */
  359. exportToXml(xmlFile)
  360. {
  361. try
  362. {
  363. let xmlData = this.getJavaClass().exportToXmlSync();
  364. let isSaved = xmlData != null;
  365. if (isSaved)
  366. {
  367. fs.writeFileSync(xmlFile, xmlData);
  368. }
  369. return isSaved;
  370. } catch (ex)
  371. {
  372. let barcode_exception = new joint.BarcodeException(ex);
  373. throw barcode_exception;
  374. }
  375. }
  376. /**
  377. * Exports BarCode properties to the xml-file specified<br>
  378. * @param xmlFile The name of the file<br>
  379. * @return Whether or not export completed successfully. Returns True in case of success; False Otherwise
  380. */
  381. static importFromXml(xmlFile)
  382. {
  383. try
  384. {
  385. let xmlData = fs.readFileSync(xmlFile).toString();
  386. let java_class_link = new java.import(BarCodeReader.javaClassName);
  387. return BarCodeReader.construct(java_class_link.importFromXmlSync(xmlData.substring(3, xmlData.length)));
  388. } catch (ex)
  389. {
  390. let barcode_exception = new joint.BarcodeException(ex);
  391. throw barcode_exception;
  392. }
  393. }
  394. }
  395. /**
  396. * Stores a set of four Points that represent a Quadrangle region.
  397. */
  398. class Quadrangle extends joint.BaseJavaClass
  399. {
  400. static get javaClassName()
  401. {
  402. return "com.aspose.mw.barcode.recognition.MwQuadrangle";
  403. }
  404. leftTop;
  405. rightTop;
  406. rightBottom;
  407. leftBottom;
  408. /**
  409. * Represents a Quadrangle structure with its properties left uninitialized.Value: Quadrangle
  410. */
  411. static get EMPTY()
  412. {
  413. return new Quadrangle(new joint.Point(0, 0), new joint.Point(0, 0), new joint.Point(0, 0), new joint.Point(0, 0));
  414. }
  415. static construct(...args)
  416. {
  417. let quadrangle = Quadrangle.EMPTY;
  418. quadrangle.setJavaClass(args[0]);
  419. return quadrangle;
  420. }
  421. /**
  422. * Initializes a new instance of the Quadrangle structure with the describing points.
  423. *
  424. * @param leftTop A Point that represents the left-top corner of the Quadrangle.
  425. * @param rightTop A Point that represents the right-top corner of the Quadrangle.
  426. * @param rightBottom A Point that represents the right-bottom corner of the Quadrangle.
  427. * @param leftBottom A Point that represents the left-bottom corner of the Quadrangle.
  428. */
  429. constructor(leftTop, rightTop, rightBottom, leftBottom)
  430. {
  431. let java_link = java.import(Quadrangle.javaClassName);
  432. let javaClass = new java_link(leftTop.getJavaClass(), rightTop.getJavaClass(), rightBottom.getJavaClass(), leftBottom.getJavaClass());
  433. super(javaClass);
  434. this.init();
  435. }
  436. init()
  437. {
  438. this.leftTop = joint.Point.construct(this.getJavaClass().getLeftTopSync());
  439. this.rightTop = joint.Point.construct(this.getJavaClass().getRightTopSync());
  440. this.rightBottom = joint.Point.construct(this.getJavaClass().getRightBottomSync());
  441. this.leftBottom = joint.Point.construct(this.getJavaClass().getLeftBottomSync());
  442. }
  443. /**
  444. * Gets left-top corner Point of Quadrangle regionValue: A left-top corner Point of Quadrangle region
  445. */
  446. getLeftTop()
  447. {
  448. return this.leftTop;
  449. }
  450. /**
  451. * Sets left-top corner Point of Quadrangle regionValue: A left-top corner Point of Quadrangle region
  452. */
  453. setLeftTop(value)
  454. {
  455. this.leftTop = value;
  456. this.getJavaClass().setLeftTopSync(value.getJavaClass());
  457. }
  458. /**
  459. * Gets right-top corner Point of Quadrangle regionValue: A right-top corner Point of Quadrangle region
  460. */
  461. getRightTop()
  462. {
  463. return this.rightTop;
  464. }
  465. /**
  466. * Sets right-top corner Point of Quadrangle regionValue: A right-top corner Point of Quadrangle region
  467. */
  468. setRightTop(value)
  469. {
  470. this.rightTop = value;
  471. this.getJavaClass().setRightTopSync(value.getJavaClass());
  472. }
  473. /**
  474. * Gets right-bottom corner Point of Quadrangle regionValue: A right-bottom corner Point of Quadrangle region
  475. */
  476. getRightBottom()
  477. {
  478. return this.rightBottom;
  479. }
  480. /**
  481. * Sets right-bottom corner Point of Quadrangle regionValue: A right-bottom corner Point of Quadrangle region
  482. */
  483. setRightBottom(value)
  484. {
  485. this.rightBottom = value;
  486. this.getJavaClass().setRightBottomSync(value.getJavaClass());
  487. }
  488. /**
  489. * Gets left-bottom corner Point of Quadrangle regionValue: A left-bottom corner Point of Quadrangle region
  490. */
  491. getLeftBottom()
  492. {
  493. return this.leftBottom;
  494. }
  495. /**
  496. * Sets left-bottom corner Point of Quadrangle regionValue: A left-bottom corner Point of Quadrangle region
  497. */
  498. setLeftBottom(value)
  499. {
  500. this.leftBottom = value;
  501. this.getJavaClass().setLeftBottomSync(value.getJavaClass());
  502. }
  503. /**
  504. * Tests whether all Points of this Quadrangle have values of zero.Value: Returns true if all Points of this Quadrangle have values of zero; otherwise, false.
  505. */
  506. isEmpty()
  507. {
  508. return this.getJavaClass().isEmptySync();
  509. }
  510. /**
  511. * Determines if the specified Point is contained within this Quadrangle structure.
  512. *
  513. * @param pt The Point to test.
  514. * @return true if Point is contained within this Quadrangle structure; otherwise, false.
  515. */
  516. contains(pt)
  517. {
  518. return this.getJavaClass().containsSync(pt.getJavaClass());
  519. }
  520. /**
  521. * Determines if the specified point is contained within this Quadrangle structure.
  522. *
  523. * @param x The x point cordinate.
  524. * @param y The y point cordinate.
  525. * @return Returns true if point is contained within this Quadrangle structure; otherwise, false.
  526. */
  527. containsPoint(x, y)
  528. {
  529. return this.getJavaClass().containsSync(x, y);
  530. }
  531. /**
  532. * Determines if the specified Quadrangle is contained or intersect this Quadrangle structure.
  533. *
  534. * @param quad The Quadrangle to test.
  535. * @return Returns true if Quadrangle is contained or intersect this Quadrangle structure; otherwise, false.
  536. */
  537. containsQuadrangle(quad)
  538. {
  539. return this.getJavaClass().containsSync(quad.getJavaClass());
  540. }
  541. /**
  542. * Determines if the specified Rectangle is contained or intersect this Quadrangle structure.
  543. *
  544. * @param rect The Rectangle to test.
  545. * @return Returns true if Rectangle is contained or intersect this Quadrangle structure; otherwise, false.
  546. */
  547. containsRectangle(rect)
  548. {
  549. return this.getJavaClass().containsSync(rect.getJavaClass());
  550. }
  551. /**
  552. * Returns a value indicating whether this instance is equal to a specified Quadrangle value.
  553. *
  554. * @param other An Quadrangle value to compare to this instance.
  555. * @return true if obj has the same value as this instance; otherwise, false.
  556. */
  557. equals(other)
  558. {
  559. return this.getJavaClass().equalsSync(other.getJavaClass());
  560. }
  561. /**
  562. * Returns the hash code for this instance.
  563. *
  564. * @return A 32-bit signed integer hash code.
  565. */
  566. hashCode()
  567. {
  568. return this.getJavaClass().hashCodeSync();
  569. }
  570. /**
  571. * Returns a human-readable string representation of this Quadrangle.
  572. *
  573. * @return A string that represents this Quadrangle.
  574. */
  575. toString()
  576. {
  577. return this.getJavaClass().toStringSync();
  578. }
  579. /**
  580. * Creates Rectangle bounding this Quadrangle
  581. *
  582. * @return returns Rectangle bounding this Quadrangle
  583. */
  584. getBoundingRectangle()
  585. {
  586. return joint.Rectangle.construct(this.getJavaClass().getBoundingRectangleSync());
  587. }
  588. }
  589. /**
  590. * Stores a QR Structured Append information of recognized barcode
  591. * @example
  592. * //This sample shows how to get QR Structured Append data
  593. *
  594. * let reader = new BarCodeReader("test.png", null, DecodeType.QR);
  595. * reader.readBarCodes().forEach(function(result, i, results)
  596. * {
  597. * console.log("BarCode Type: " + result.getCodeTypeName());
  598. * console.log("BarCode CodeText: " + result.getCodeText());
  599. * console.log("QR Structured Append Quantity: " + result.getExtended().getQR().getQRStructuredAppendModeBarCodesQuantity());
  600. * console.log("QR Structured Append Index: " + result.getExtended().getQR().getQRStructuredAppendModeBarCodeIndex());
  601. * console.log("QR Structured Append ParityData: " + result.getExtended().getQR().getQRStructuredAppendModeParityData());
  602. * });
  603. */
  604. class QRExtendedParameters extends joint.BaseJavaClass
  605. {
  606. constructor(javaclass)
  607. {
  608. super(javaclass);
  609. this.init()
  610. }
  611. init()
  612. {
  613. }
  614. /**
  615. * Gets the QR structured append mode barcodes quantity. Default value is -1.Value: The quantity of the QR structured append mode barcode.
  616. */
  617. getQRStructuredAppendModeBarCodesQuantity()
  618. {
  619. return this.getJavaClass().getQRStructuredAppendModeBarCodesQuantitySync();
  620. }
  621. /**
  622. * Gets the index of the QR structured append mode barcode. Index starts from 0. Default value is -1.Value: The quantity of the QR structured append mode barcode.
  623. */
  624. getQRStructuredAppendModeBarCodeIndex()
  625. {
  626. return this.getJavaClass().getQRStructuredAppendModeBarCodeIndexSync();
  627. }
  628. /**
  629. * Gets the QR structured append mode parity data. Default value is -1.Value: The index of the QR structured append mode barcode.
  630. */
  631. getQRStructuredAppendModeParityData()
  632. {
  633. return this.getJavaClass().getQRStructuredAppendModeParityDataSync();
  634. }
  635. /**
  636. * Version of recognized QR Code. From Version1 to Version40.
  637. * @return Version of recognized QR Code
  638. */
  639. getQRVersion()
  640. { return this.getJavaClass().getQRVersionSync(); }
  641. /**
  642. * Version of recognized MicroQR Code. From M1 to M4.
  643. * @return Version of recognized MicroQR Code. From M1 to M4.
  644. */
  645. getMicroQRVersion()
  646. { return this.getJavaClass().getMicroQRVersionSync(); }
  647. /**
  648. * Version of recognized RectMicroQR Code. From R7x43 to R17x139.
  649. * @return Version of recognized RectMicroQR Code
  650. */
  651. getRectMicroQRVersion()
  652. { return this.getJavaClass().getRectMicroQRVersionSync(); }
  653. /**
  654. * Reed-Solomon error correction level of recognized barcode. From low to high: LevelL, LevelM, LevelQ, LevelH.
  655. * @return Reed-Solomon error correction level of recognized barcode.
  656. */
  657. getQRErrorLevel()
  658. {return this.getJavaClass().getQRErrorLevelSync(); }
  659. /**
  660. * <p>Tests whether all parameters has only default values</p>Value
  661. * @returns <b>true</b> if all parameters has only default values; otherwise, {@code <b>false</b>}.
  662. */
  663. isEmpty()
  664. {
  665. return this.getJavaClass().isEmptySync();
  666. }
  667. /**
  668. * Returns a value indicating whether this instance is equal to a specified QRExtendedParameters value.
  669. *
  670. * @param obj An object value to compare to this instance.
  671. * @return true if obj has the same value as this instance; otherwise, false.
  672. */
  673. equals(obj)
  674. {
  675. return this.getJavaClass().equalsSync(obj.getJavaClass());
  676. }
  677. /**
  678. * Returns the hash code for this instance.
  679. *
  680. * @return A 32-bit signed integer hash code.
  681. */
  682. hashCode()
  683. {
  684. return this.getJavaClass().hashCodeSync();
  685. }
  686. /**
  687. * Returns a human-readable string representation of this QRExtendedParameters.
  688. *
  689. * @return A string that represents this QRExtendedParameters.
  690. */
  691. toString()
  692. {
  693. return this.getJavaClass().toStringSync();
  694. }
  695. }
  696. /**
  697. * Stores a MacroPdf417 metadata information of recognized barcode
  698. * @example
  699. * //This sample shows how to get Macro Pdf417 metadata
  700. * let generator = new BarcodeGenerator(EncodeTypes.MacroPdf417, "12345");
  701. * generator.getParameters().getBarcode().getPdf417().setPdf417MacroFileID(10);
  702. * generator.getParameters().getBarcode().getPdf417().setPdf417MacroSegmentsCount(2);
  703. * generator.getParameters().getBarcode().getPdf417().setPdf417MacroSegmentID(1);
  704. * generator.save("test.png");
  705. * let reader = new BarCodeReader("test.png", null, DecodeType.MACRO_PDF_417);
  706. * reader.readBarCodes().forEach(function(result, i, results)
  707. * {
  708. * console.log("BarCode Type: " + result.getCodeTypeName());
  709. * console.log("BarCode CodeText: " + result.getCodeText());
  710. * console.log("Macro Pdf417 FileID: " + result.getExtended().getPdf417().getMacroPdf417FileID());
  711. * console.log("Macro Pdf417 Segments: " + result.getExtended().getPdf417().getMacroPdf417SegmentsCount());
  712. * console.log("Macro Pdf417 SegmentID: " + result.getExtended().getPdf417().getMacroPdf417SegmentID());
  713. * });
  714. */
  715. class Pdf417ExtendedParameters extends joint.BaseJavaClass
  716. {
  717. constructor(javaclass)
  718. {
  719. super(javaclass);
  720. this.init()
  721. }
  722. init()
  723. {
  724. }
  725. /**
  726. * Gets the file ID of the barcode, only available with MacroPdf417.Value: The file ID for MacroPdf417
  727. */
  728. getMacroPdf417FileID()
  729. {
  730. return this.getJavaClass().getMacroPdf417FileIDSync();
  731. }
  732. /**
  733. * Gets the segment ID of the barcode,only available with MacroPdf417.Value: The segment ID of the barcode.
  734. */
  735. getMacroPdf417SegmentID()
  736. {
  737. return this.getJavaClass().getMacroPdf417SegmentIDSync();
  738. }
  739. /**
  740. * Gets macro pdf417 barcode segments count. Default value is -1.Value: Segments count.
  741. */
  742. getMacroPdf417SegmentsCount()
  743. {
  744. return this.getJavaClass().getMacroPdf417SegmentsCountSync();
  745. }
  746. /**
  747. * Macro PDF417 file name (optional).
  748. * @return File name.
  749. */
  750. getMacroPdf417FileName()
  751. {
  752. return this.getJavaClass().getMacroPdf417FileNameSync();
  753. }
  754. /**
  755. * Macro PDF417 file size (optional).
  756. * @return File size.
  757. */
  758. getMacroPdf417FileSize()
  759. {
  760. return this.getJavaClass().getMacroPdf417FileSizeSync();
  761. }
  762. /**
  763. * Macro PDF417 sender name (optional).
  764. * @return Sender name
  765. */
  766. getMacroPdf417Sender()
  767. {
  768. return this.getJavaClass().getMacroPdf417SenderSync();
  769. }
  770. /**
  771. * Macro PDF417 addressee name (optional).
  772. * @return Addressee name.
  773. */
  774. getMacroPdf417Addressee()
  775. {
  776. return this.getJavaClass().getMacroPdf417AddresseeSync();
  777. }
  778. /**
  779. * Macro PDF417 time stamp (optional).
  780. * @return Time stamp.
  781. */
  782. getMacroPdf417TimeStamp()
  783. {
  784. return new Date(this.getJavaClass().getMacroPdf417TimeStampSync() * 1000);
  785. }
  786. /**
  787. * Macro PDF417 checksum (optional).
  788. * @return Checksum.
  789. */
  790. getMacroPdf417Checksum()
  791. {
  792. return this.getJavaClass().getMacroPdf417ChecksumSync();
  793. }
  794. /**
  795. * <p>Used to instruct the reader to interpret the data contained within the symbol as programming for reader initialization.</p>
  796. * @return Reader initialization flag
  797. */
  798. getMacroPdf417Terminator()
  799. {
  800. return this.getJavaClass().getMacroPdf417TerminatorSync();
  801. }
  802. /**
  803. * <p>
  804. * Used to instruct the reader to interpret the data contained within the symbol as programming for reader initialization.
  805. * </p>
  806. *
  807. * @return Reader initialization flag
  808. */
  809. isReaderInitialization()
  810. {
  811. return this.getJavaClass().isReaderInitializationSync();
  812. }
  813. /**
  814. * <p>Flag that indicates that the barcode must be linked to 1D barcode.</p>Value: Linkage flag
  815. */
  816. isLinked()
  817. {
  818. return this.getJavaClass().isLinkedSync();
  819. }
  820. /**
  821. * Flag that indicates that the MicroPdf417 barcode encoded with 908, 909, 910 or 911 Code 128 emulation codewords.
  822. * @return Code 128 emulation flag
  823. */
  824. isCode128Emulation()
  825. {
  826. return this.getJavaClass().isCode128EmulationSync();
  827. }
  828. /**
  829. * Returns a value indicating whether this instance is equal to a specified Pdf417ExtendedParameters value.
  830. *
  831. * @param obj An System.Object value to compare to this instance.
  832. * @return true if obj has the same value as this instance; otherwise, false.
  833. */
  834. equals(obj)
  835. {
  836. return this.getJavaClass().equalsSync(obj.getJavaClass());
  837. }
  838. /**
  839. * Returns the hash code for this instance.
  840. * @return A 32-bit signed integer hash code.
  841. */
  842. hashCode()
  843. {
  844. return this.getJavaClass().hashCodeSync();
  845. }
  846. /**
  847. * Returns a human-readable string representation of this Pdf417ExtendedParameters.
  848. *
  849. * @return A string that represents this Pdf417ExtendedParameters.
  850. */
  851. toString()
  852. {
  853. return this.getJavaClass().toStringSync();
  854. }
  855. }
  856. /**
  857. * Stores special data of 1D recognized barcode like separate codetext and checksum
  858. * @example
  859. * //This sample shows how to get 1D barcode value and checksum
  860. * let generator = new BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128");
  861. * generator.save("test.png");
  862. * let reader = new BarCodeReader("test.png", null, DecodeType.EAN_13);
  863. * reader.readBarCodes().forEach(function(result, i, results)
  864. * {
  865. * console.log("BarCode Type: " + result.getCodeTypeName());
  866. * console.log("BarCode CodeText: " + result.getCodeText());
  867. * console.log("BarCode Value: " + result.getExtended().getOneD().getValue());
  868. * console.log("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum());
  869. * });
  870. */
  871. class OneDExtendedParameters extends joint.BaseJavaClass
  872. {
  873. constructor(javaclass)
  874. {
  875. super(javaclass);
  876. this.init()
  877. }
  878. init()
  879. {
  880. }
  881. /**
  882. * Gets the codetext of 1D barcodes without checksum. Value: The codetext of 1D barcodes without checksum.
  883. */
  884. getValue()
  885. {
  886. return this.getJavaClass().getValueSync();
  887. }
  888. /**
  889. * Gets the checksum for 1D barcodes. Value: The checksum for 1D barcode.
  890. */
  891. getCheckSum()
  892. {
  893. return this.getJavaClass().getCheckSumSync();
  894. }
  895. /**
  896. * Tests whether all parameters has only default values
  897. * Value: Returns {@code <b>true</b>} if all parameters has only default values; otherwise, {@code <b>false</b>}.
  898. */
  899. isEmpty()
  900. {
  901. return this.getJavaClass().isEmptySync();
  902. }
  903. /**
  904. * Returns a value indicating whether this instance is equal to a specified OneDExtendedParameters value.
  905. *
  906. * @param obj An System.Object value to compare to this instance.
  907. * @return true if obj has the same value as this instance; otherwise, false.
  908. */
  909. equals(obj)
  910. {
  911. return this.getJavaClass().equalsSync(obj.getJavaClass());
  912. }
  913. /**
  914. * Returns the hash code for this instance.
  915. *
  916. * @return A 32-bit signed integer hash code.
  917. */
  918. hashCode()
  919. {
  920. return this.getJavaClass().hashCodeSync();
  921. }
  922. /**
  923. * Returns a human-readable string representation of this OneDExtendedParameters.
  924. *
  925. * @return A string that represents this OneDExtendedParameters.
  926. */
  927. toString()
  928. {
  929. return this.getJavaClass().toStringSync();
  930. }
  931. }
  932. /**
  933. * Stores special data of Code128 recognized barcode<br>
  934. * Represents the recognized barcode's region and barcode angle
  935. * @example
  936. * //This sample shows how to get code128 raw values
  937. * let generator = new BarcodeGenerator(EncodeTypes.Code128, "12345");
  938. * generator.save("test.png");
  939. * let reader = new BarCodeReader("test.png", null, DecodeType.CODE_128);
  940. * reader.readBarCodes().forEach(function(result, i, results)
  941. * {
  942. * console.log("BarCode Type: " + result.getCodeTypeName());
  943. * console.log("BarCode CodeText: " + result.getCodeText());
  944. * console.log("Code128 Data Portions: " + result.getExtended().getCode128());
  945. * });
  946. */
  947. class Code128ExtendedParameters extends joint.BaseJavaClass
  948. {
  949. code128DataPortions;
  950. constructor(javaclass)
  951. {
  952. super(javaclass);
  953. this.init()
  954. }
  955. init()
  956. {
  957. this.code128DataPortions = Code128ExtendedParameters.convertCode128DataPortions(this.getJavaClass().getCode128DataPortionsSync());
  958. }
  959. static convertCode128DataPortions(javaCode128DataPortions)
  960. {
  961. let code128DataPortionsValues = javaCode128DataPortions;
  962. let code128DataPortions = [];
  963. for (let i = 0; i < code128DataPortionsValues.length; i++)
  964. {
  965. code128DataPortions.push(new Code128DataPortion(code128DataPortionsValues[i]));
  966. }
  967. return code128DataPortions;
  968. }
  969. /**
  970. * Gets Code128DataPortion array of recognized Code128 barcode Value of the Code128DataPortion.
  971. */
  972. getCode128DataPortions()
  973. {
  974. return this.code128DataPortions;
  975. }
  976. isEmpty()
  977. {
  978. return this.getJavaClass().isEmptySync();
  979. }
  980. /**
  981. * Returns a value indicating whether this instance is equal to a specified Code128ExtendedParameters value.
  982. *
  983. * @param obj An System.Object value to compare to this instance.
  984. * @return true if obj has the same value as this instance; otherwise, false.
  985. */
  986. equals(obj)
  987. {
  988. return this.getJavaClass().equalsSync(obj.getJavaClass());
  989. }
  990. /**
  991. * Returns the hash code for this instance.
  992. *
  993. * @return A 32-bit signed integer hash code.
  994. */
  995. hashCode()
  996. {
  997. return this.getJavaClass().hashCodeSync();
  998. }
  999. /**
  1000. * Returns a human-readable string representation of this Code128ExtendedParameters.
  1001. *
  1002. * @return A string that represents this Code128ExtendedParameters.
  1003. */
  1004. toString()
  1005. {
  1006. return this.getJavaClass().toStringSync();
  1007. }
  1008. }
  1009. /**
  1010. * Stores recognized barcode data like SingleDecodeType type, {@code string} codetext,<br>
  1011. * BarCodeRegionParameters region and other parameters
  1012. * @example
  1013. * //This sample shows how to obtain BarCodeResult.
  1014. * let generator = new BarcodeGenerator(EncodeTypes.Code128, "12345");
  1015. * generator.save("test.png");
  1016. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  1017. * reader.readBarCodes().forEach(function(result, i, results)
  1018. * {
  1019. * console.log("BarCode Type: " + result.getCodeTypeName());
  1020. * console.log("BarCode CodeText: " + result.getCodeText());
  1021. * console.log("BarCode Confidence: " + result.getConfidence());
  1022. * console.log("BarCode ReadingQuality: " + result.getReadingQuality());
  1023. * console.log("BarCode Angle: " + result.getRegion().getAngle());
  1024. * });
  1025. */
  1026. class BarCodeResult extends joint.BaseJavaClass
  1027. {
  1028. region;
  1029. extended;
  1030. constructor(javaclass)
  1031. {
  1032. super(javaclass);
  1033. this.init()
  1034. }
  1035. init()
  1036. {
  1037. this.region = new BarCodeRegionParameters(this.getJavaClass().getRegionSync());
  1038. this.extended = new BarCodeExtendedParameters(this.getJavaClass().getExtendedSync());
  1039. }
  1040. /**
  1041. * Gets the reading quality. Works for 1D and postal barcodes. Value: The reading quality percent
  1042. */
  1043. getReadingQuality()
  1044. {
  1045. return this.getJavaClass().getReadingQualitySync();
  1046. }
  1047. /**
  1048. * Gets recognition confidence level of the recognized barcode Value: <br>
  1049. * BarCodeConfidence.Strong does not have fakes or misrecognitions, BarCodeConfidence.Moderate<br>
  1050. * could sometimes have fakes or incorrect codetext because this confidence level for barcodews with weak cheksum or even without it,<br>
  1051. * BarCodeConfidence.NONE always has incorrect codetext and could be fake recognitions
  1052. */
  1053. getConfidence()
  1054. {
  1055. return this.getJavaClass().getConfidenceSync();
  1056. }
  1057. /**
  1058. * Gets the code text Value: The code text of the barcode
  1059. */
  1060. getCodeText()
  1061. {
  1062. return this.getJavaClass().getCodeTextSync();
  1063. }
  1064. /**
  1065. * Gets the encoded code bytes Value: The code bytes of the barcode
  1066. */
  1067. getCodeBytes()
  1068. {
  1069. let str = this.getJavaClass().getCodeBytesSync();
  1070. return str.split(",");
  1071. }
  1072. /**
  1073. * Gets the barcode type Value: The type information of the recognized barcode
  1074. */
  1075. getCodeType()
  1076. {
  1077. return this.getJavaClass().getCodeTypeSync();
  1078. }
  1079. /**
  1080. * Gets the name of the barcode type Value: The type name of the recognized barcode
  1081. */
  1082. getCodeTypeName()
  1083. {
  1084. return this.getJavaClass().getCodeTypeNameSync();
  1085. }
  1086. /**
  1087. * Gets the barcode region Value: The region of the recognized barcode
  1088. */
  1089. getRegion()
  1090. {
  1091. return this.region;
  1092. }
  1093. /**
  1094. * Gets extended parameters of recognized barcode Value: The extended parameters of recognized barcode
  1095. */
  1096. getExtended()
  1097. {
  1098. return this.extended;
  1099. }
  1100. /**
  1101. * Returns a value indicating whether this instance is equal to a specified BarCodeResult value.
  1102. *
  1103. * @param other An BarCodeResult value to compare to this instance.
  1104. * @return true if obj has the same value as this instance; otherwise, false.
  1105. */
  1106. equals(other)
  1107. {
  1108. return this.getJavaClass().equalsSync(other.getJavaClass());
  1109. }
  1110. /**
  1111. * Returns the hash code for this instance.
  1112. *
  1113. * @return A 32-bit signed integer hash code.
  1114. */
  1115. hashCode()
  1116. {
  1117. return this.getJavaClass().hashCodeSync();
  1118. }
  1119. /**
  1120. * Returns a human-readable string representation of this BarCodeResult.
  1121. *
  1122. * @return A string that represents this BarCodeResult.
  1123. */
  1124. toString()
  1125. {
  1126. return this.getJavaClass().toStringSync();
  1127. }
  1128. /**
  1129. * Creates a copy of BarCodeResult class.
  1130. *
  1131. * @return Returns copy of BarCodeResult class.
  1132. */
  1133. deepClone()
  1134. {
  1135. return new BarCodeResult(this);
  1136. }
  1137. }
  1138. /**
  1139. * Represents the recognized barcode's region and barcode angle
  1140. * @example
  1141. * //This sample shows how to get barcode Angle and bounding quadrangle values
  1142. * let generator = new BarcodeGenerator(EncodeTypes.Code128, "12345");
  1143. * generator.save("test.png");
  1144. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  1145. * reader.readBarCodes().forEach(function(result, i, results)
  1146. * {
  1147. * console.log("BarCode CodeText: " + result.getCodeText());
  1148. * console.log("BarCode Angle: " + result.getRegion().getAngle());
  1149. * console.log("BarCode Quadrangle: " + result.getRegion().getQuadrangle());
  1150. * });
  1151. */
  1152. class BarCodeRegionParameters extends joint.BaseJavaClass
  1153. {
  1154. quad;
  1155. rect;
  1156. points;
  1157. constructor(javaclass)
  1158. {
  1159. super(javaclass);
  1160. this.init()
  1161. }
  1162. init()
  1163. {
  1164. this.quad = Quadrangle.construct(this.getJavaClass().getQuadrangleSync());
  1165. this.rect = joint.Rectangle.construct(this.getJavaClass().getRectangleSync());
  1166. this.points = BarCodeRegionParameters.convertJavaPoints(this.getJavaClass().getPointsSync());
  1167. }
  1168. static convertJavaPoints(javaPoints)
  1169. {
  1170. let points = [];
  1171. for (let i = 0; i < javaPoints.length; i++)
  1172. {
  1173. points[i] = new joint.Point(javaPoints[i].getXSync(), javaPoints[i].getYSync());
  1174. }
  1175. return points;
  1176. }
  1177. /**
  1178. * Gets Quadrangle bounding barcode region Value: Returns Quadrangle bounding barcode region
  1179. */
  1180. getQuadrangle()
  1181. {
  1182. return this.quad;
  1183. }
  1184. /**
  1185. * Gets the angle of the barcode (0-360). Value: The angle for barcode (0-360).
  1186. */
  1187. getAngle()
  1188. {
  1189. return this.getJavaClass().getAngleSync();
  1190. }
  1191. /**
  1192. * Gets Points array bounding barcode region Value: Returns Points array bounding barcode region
  1193. */
  1194. getPoints()
  1195. {
  1196. return this.points;
  1197. }
  1198. /**
  1199. * Gets Rectangle bounding barcode region Value: Returns Rectangle bounding barcode region
  1200. */
  1201. getRectangle()
  1202. {
  1203. return this.rect;
  1204. }
  1205. /**
  1206. * Returns a value indicating whether this instance is equal to a specified BarCodeRegionParameters value.<br>
  1207. *
  1208. * @param obj An System.Object value to compare to this instance.<br>
  1209. * @return true if obj has the same value as this instance; otherwise, false.
  1210. */
  1211. equals(obj)
  1212. {
  1213. return this.getJavaClass().equalsSync(obj.getJavaClass());
  1214. }
  1215. /**
  1216. * Returns the hash code for this instance.<br>
  1217. *
  1218. * @return A 32-bit signed integer hash code.
  1219. */
  1220. hashCode()
  1221. {
  1222. return this.getJavaClass().hashCodeSync();
  1223. }
  1224. /**
  1225. * Returns a human-readable string representation of this BarCodeRegionParameters.<br>
  1226. *
  1227. * @return A string that represents this BarCodeRegionParameters.
  1228. */
  1229. toString()
  1230. {
  1231. return this.getJavaClass().toStringSync();
  1232. }
  1233. }
  1234. /**
  1235. * Stores extended parameters of recognized barcode
  1236. */
  1237. class BarCodeExtendedParameters extends joint.BaseJavaClass
  1238. {
  1239. _oneDParameters;
  1240. _code128Parameters;
  1241. _qrParameters;
  1242. _pdf417Parameters;
  1243. _dataBarParameters;
  1244. _maxiCodeParameters;
  1245. _dotCodeExtendedParameters;
  1246. _dataMatrixExtendedParameters;
  1247. _aztecExtendedParameters;
  1248. _gs1CompositeBarExtendedParameters;
  1249. _codabarExtendedParameters;
  1250. constructor(javaclass)
  1251. {
  1252. super(javaclass);
  1253. this.init()
  1254. }
  1255. init()
  1256. {
  1257. this._oneDParameters = new OneDExtendedParameters(this.getJavaClass().getOneDSync());
  1258. this._code128Parameters = new Code128ExtendedParameters(this.getJavaClass().getCode128Sync());
  1259. this._qrParameters = new QRExtendedParameters(this.getJavaClass().getQRSync());
  1260. this._pdf417Parameters = new Pdf417ExtendedParameters(this.getJavaClass().getPdf417Sync());
  1261. this._dataBarParameters = new DataBarExtendedParameters(this.getJavaClass().getDataBarSync());
  1262. this._maxiCodeParameters = new MaxiCodeExtendedParameters(this.getJavaClass().getMaxiCodeSync());
  1263. this._dotCodeExtendedParameters = new DotCodeExtendedParameters(this.getJavaClass().getDotCodeSync());
  1264. this._dataMatrixExtendedParameters = new DataMatrixExtendedParameters(this.getJavaClass().getDataMatrixSync());
  1265. this._aztecExtendedParameters = new AztecExtendedParameters(this.getJavaClass().getAztecSync());
  1266. this._gs1CompositeBarExtendedParameters = new GS1CompositeBarExtendedParameters(this.getJavaClass().getGS1CompositeBarSync());
  1267. this._codabarExtendedParameters = new CodabarExtendedParameters(this.getJavaClass().getCodabarSync());
  1268. }
  1269. /**
  1270. * Gets a DataBar additional information DataBarExtendedParameters of recognized barcode<br>
  1271. * @return mixed A DataBar additional information DataBarExtendedParameters of recognized barcode
  1272. */
  1273. getDataBar()
  1274. {
  1275. return this._dataBarParameters;
  1276. }
  1277. /**
  1278. * Gets a MaxiCode additional information<see cref="MaxiCodeExtendedParameters"/> of recognized barcode
  1279. *
  1280. * @return A MaxiCode additional information<see cref="MaxiCodeExtendedParameters"/> of recognized barcode
  1281. */
  1282. getMaxiCode()
  1283. {
  1284. return this._maxiCodeParameters;
  1285. }
  1286. /**
  1287. * Gets a special data OneDExtendedParameters of 1D recognized barcode Value: A special data OneDExtendedParameters of 1D recognized barcode
  1288. */
  1289. getOneD()
  1290. {
  1291. return this._oneDParameters;
  1292. }
  1293. /**
  1294. * <p>Gets a DotCode additional information{@code DotCodeExtendedParameters} of recognized barcode</p>Value: A DotCode additional information{@code DotCodeExtendedParameters} of recognized barcode
  1295. */
  1296. getDotCode()
  1297. {
  1298. return this._dotCodeExtendedParameters;
  1299. }
  1300. /**
  1301. * <p>Gets a DotCode additional information{@code DotCodeExtendedParameters} of recognized barcode</p>Value: A DotCode additional information{@code DotCodeExtendedParameters} of recognized barcode
  1302. */
  1303. getDataMatrix()
  1304. {
  1305. return this._dataMatrixExtendedParameters;
  1306. }
  1307. /**
  1308. * <p>Gets a Aztec additional information{@code AztecExtendedParameters} of recognized barcode</p>Value: A Aztec additional information{@code AztecExtendedParameters} of recognized barcode
  1309. */
  1310. getAztec()
  1311. {
  1312. return this._aztecExtendedParameters;
  1313. }
  1314. /**
  1315. * <p>Gets a GS1CompositeBar additional information{@code GS1CompositeBarExtendedParameters} of recognized barcode</p>Value: A GS1CompositeBar additional information{@code GS1CompositeBarExtendedParameters} of recognized barcode
  1316. */
  1317. getGS1CompositeBar()
  1318. {
  1319. return this._gs1CompositeBarExtendedParameters;
  1320. }
  1321. /**
  1322. * Gets a Codabar additional information{@code CodabarExtendedParameters} of recognized barcode
  1323. * @return A Codabar additional information{@code CodabarExtendedParameters} of recognized barcode
  1324. */
  1325. getCodabar()
  1326. {
  1327. return this._codabarExtendedParameters;
  1328. }
  1329. /**
  1330. * Gets a special data Code128ExtendedParameters of Code128 recognized barcode Value: A special data Code128ExtendedParameters of Code128 recognized barcode
  1331. */
  1332. getCode128()
  1333. {
  1334. return this._code128Parameters;
  1335. }
  1336. /**
  1337. * Gets a QR Structured Append information QRExtendedParameters of recognized barcode Value: A QR Structured Append information QRExtendedParameters of recognized barcode
  1338. */
  1339. getQR()
  1340. {
  1341. return this._qrParameters;
  1342. }
  1343. /**
  1344. * Gets a MacroPdf417 metadata information Pdf417ExtendedParameters of recognized barcode Value: A MacroPdf417 metadata information Pdf417ExtendedParameters of recognized barcode
  1345. */
  1346. getPdf417()
  1347. {
  1348. return this._pdf417Parameters;
  1349. }
  1350. /**
  1351. * Returns a value indicating whether this instance is equal to a specified BarCodeExtendedParameters value.<br>
  1352. *
  1353. * @param obj An System.Object value to compare to this instance.
  1354. * @return true if obj has the same value as this instance; otherwise, false.
  1355. */
  1356. equals(obj)
  1357. {
  1358. return this.getJavaClass().equalsSync(obj.getJavaClass());
  1359. }
  1360. /**
  1361. * Returns the hash code for this instance.
  1362. *
  1363. * @return A 32-bit signed integer hash code.
  1364. */
  1365. hashCode()
  1366. {
  1367. return this.getJavaClass().hashCodeSync();
  1368. }
  1369. /**
  1370. * Returns a human-readable string representation of this BarCodeExtendedParameters.
  1371. *
  1372. * @return A string that represents this BarCodeExtendedParameters.
  1373. */
  1374. toString()
  1375. {
  1376. return this.getJavaClass().toStringSync();
  1377. }
  1378. }
  1379. /**
  1380. * QualitySettings allows to configure recognition quality and speed manually.<br>
  1381. * You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality,<br>
  1382. * HighQuality, MaxBarCodes or you can manually configure separate options.<br>
  1383. * Default value of QualitySettings is NormalQuality.
  1384. * @example
  1385. * //This sample shows how to use QualitySettings with BarCodeReader
  1386. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  1387. * //set high performance mode
  1388. * reader.setQualitySettings(QualitySettings.getHighPerformance());
  1389. * reader.readBarCodes().forEach(function(result, i, results)
  1390. * {
  1391. * console.log("BarCode CodeText: " + result.getCodeText());
  1392. * });
  1393. * @example
  1394. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  1395. * //normal quality mode is set by default
  1396. * reader.readBarCodes().forEach(function(result, i, results)
  1397. * {
  1398. * console.log("BarCode CodeText: " + result.getCodeText());
  1399. * });
  1400. * @example
  1401. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  1402. * //set high quality mode with low speed recognition
  1403. * reader.setQualitySettings(QualitySettings.getHighQuality());
  1404. * reader.readBarCodes().forEach(function(result, i, results)
  1405. * {
  1406. * console.log("BarCode CodeText: " + result.getCodeText());
  1407. * });
  1408. * @example
  1409. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  1410. * //set max barcodes mode, which tries to find all possible barcodes, even incorrect. The slowest recognition mode
  1411. * reader.setQualitySettings(QualitySettings.getMaxBarCodes());
  1412. * reader.readBarCodes().forEach(function(result, i, results)
  1413. * {
  1414. * console.log("BarCode CodeText: " + result.getCodeText());
  1415. * });
  1416. * @example
  1417. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  1418. * //set high performance mode
  1419. * reader.setQualitySettings(QualitySettings.getHighPerformance());
  1420. * //set separate options
  1421. * reader.getQualitySettings().setAllowMedianSmoothing(true);
  1422. * reader.getQualitySettings().setMedianSmoothingWindowSize(5);
  1423. * reader.readBarCodes().forEach(function(result, i, results)
  1424. * {
  1425. * console.log("BarCode CodeText: " + result.getCodeText());
  1426. * });
  1427. * @example
  1428. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  1429. * //default mode is NormalQuality
  1430. * //set separate options
  1431. * reader.getQualitySettings().setAllowMedianSmoothing(true);
  1432. * reader.getQualitySettings().setMedianSmoothingWindowSize(5);
  1433. * reader.readBarCodes().forEach(function(result, i, results)
  1434. * {
  1435. * console.log("BarCode CodeText: " + result.getCodeText());
  1436. * });
  1437. */
  1438. class QualitySettings extends joint.BaseJavaClass
  1439. {
  1440. constructor(javaClass)
  1441. {
  1442. super(javaClass);
  1443. this.init();
  1444. }
  1445. static initQualitySettings()
  1446. {
  1447. let javaClassName = "com.aspose.mw.barcode.recognition.MwQualitySettings";
  1448. let QualitySettings = java.import(javaClassName);
  1449. return QualitySettings;
  1450. }
  1451. init()
  1452. {
  1453. }
  1454. /**
  1455. * HighPerformance recognition quality preset. High quality barcodes are recognized well in this mode.<br>
  1456. * @example
  1457. * let reader = new BarCodeReader("test.png");
  1458. * reader.setQualitySettings(QualitySettings.getHighPerformance());
  1459. */
  1460. static getHighPerformance()
  1461. {
  1462. let JavaQualitySettings = QualitySettings.initQualitySettings();
  1463. return new QualitySettings(JavaQualitySettings.getHighPerformanceSync());
  1464. }
  1465. /**
  1466. * NormalQuality recognition quality preset. Suitable for the most of barcodes
  1467. *
  1468. * @example
  1469. * let reader = new BarCodeReader("test.png");
  1470. * reader.setQualitySettings(QualitySettings.getNormalQuality());
  1471. */
  1472. static getNormalQuality()
  1473. {
  1474. let JavaQualitySettings = QualitySettings.initQualitySettings();
  1475. return new QualitySettings(JavaQualitySettings.getNormalQualitySync());
  1476. }
  1477. /**
  1478. * HighQuality recognition quality preset. This preset is developed for low quality barcodes.
  1479. *
  1480. * @example
  1481. * let reader = new BarCodeReader("test.png");
  1482. * reader.setQualitySettings(QualitySettings.getHighQuality());
  1483. */
  1484. static getHighQuality()
  1485. {
  1486. let JavaQualitySettings = QualitySettings.initQualitySettings();
  1487. return new QualitySettings(JavaQualitySettings.getHighQualitySync());
  1488. }
  1489. /**
  1490. * <p>
  1491. * MaxQuality recognition quality preset. This preset is developed to recognize all possible barcodes, even incorrect barcodes.
  1492. * </p><p><hr><blockquote><pre>
  1493. * This sample shows how to use MaxQuality mode
  1494. * <pre>
  1495. *
  1496. * reader = new BarCodeReader("test.png"null, null, DecodeType.CODE_39_FULL_ASCII, DecodeType.CODE_128);
  1497. * {
  1498. * reader.setQualitySettings(QualitySettings.getMaxQuality());
  1499. * for(let i = 0; i < reader.readBarCodes().length; i++)
  1500. * echo (reader.getFoundBarcodes()[i].getCodeText());
  1501. * }
  1502. * </pre>
  1503. * </pre></blockquote></hr></p>Value:
  1504. * MaxQuality recognition quality preset.
  1505. *
  1506. */
  1507. static getMaxQuality()
  1508. {
  1509. let JavaQualitySettings = QualitySettings.initQualitySettings();
  1510. return new QualitySettings(JavaQualitySettings.getMaxQualitySync());
  1511. }
  1512. /**
  1513. * Recognition mode which sets size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
  1514. * @return size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
  1515. */
  1516. getXDimension()
  1517. {
  1518. return this.getJavaClass().getXDimensionSync();
  1519. }
  1520. /**
  1521. * Recognition mode which sets size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
  1522. * @param value (from 1 to infinity) of barcode minimal element: matrix cell or bar.
  1523. */
  1524. setXDimension(value)
  1525. {
  1526. this.getJavaClass().setXDimensionSync(value);
  1527. }
  1528. /**
  1529. * Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
  1530. * @return Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
  1531. */
  1532. getMinimalXDimension()
  1533. {
  1534. return this.getJavaClass().getMinimalXDimensionSync();
  1535. }
  1536. /**
  1537. * Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
  1538. * @param value Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
  1539. */
  1540. setMinimalXDimension(value)
  1541. {
  1542. this.getJavaClass().setMinimalXDimensionSync(value);
  1543. }
  1544. /**
  1545. * Mode which enables methods to recognize barcode elements with the selected quality. Barcode element with lower quality requires more hard methods which slows the recognition.
  1546. * @return Mode which enables methods to recognize barcode elements with the selected quality.
  1547. */
  1548. getBarcodeQuality()
  1549. {
  1550. return this.getJavaClass().getBarcodeQualitySync();
  1551. }
  1552. /**
  1553. * Mode which enables methods to recognize barcode elements with the selected quality. Barcode element with lower quality requires more hard methods which slows the recognition.
  1554. * @param value Mode which enables methods to recognize barcode elements with the selected quality.
  1555. */
  1556. setBarcodeQuality(value)
  1557. {
  1558. this.getJavaClass().setBarcodeQualitySync(value);
  1559. }
  1560. /**
  1561. * <p>
  1562. * Deconvolution (image restorations) mode which defines level of image degradation. Originally deconvolution is a function which can restore image degraded
  1563. * (convoluted) by any natural function like blur, during obtaining image by camera. Because we cannot detect image function which corrupt the image,
  1564. * we have to check most well know functions like sharp or mathematical morphology.
  1565. * @return Deconvolution mode which defines level of image degradation.
  1566. */
  1567. getDeconvolution()
  1568. {
  1569. return this.getJavaClass().getDeconvolutionSync();
  1570. }
  1571. /**
  1572. * Deconvolution (image restorations) mode which defines level of image degradation. Originally deconvolution is a function which can restore image degraded
  1573. * (convoluted) by any natural function like blur, during obtaining image by camera. Because we cannot detect image function which corrupt the image,
  1574. * we have to check most well know functions like sharp or mathematical morphology.
  1575. * @param value Deconvolution mode which defines level of image degradation.
  1576. */
  1577. setDeconvolution(value)
  1578. {
  1579. this.getJavaClass().setDeconvolutionSync(value);
  1580. }
  1581. /**
  1582. * <p>
  1583. * Mode which enables or disables additional recognition of barcodes on images with inverted colors (luminance).
  1584. * @return Additional recognition of barcodes on images with inverse colors
  1585. */
  1586. getInverseImage()
  1587. {
  1588. return this.getJavaClass().getInverseImageSync();
  1589. }
  1590. /**
  1591. * Mode which enables or disables additional recognition of barcodes on images with inverted colors (luminance).
  1592. * @param value Additional recognition of barcodes on images with inverse colors
  1593. */
  1594. setInverseImage(value)
  1595. {
  1596. this.getJavaClass().setInverseImageSync(value);
  1597. }
  1598. /**
  1599. * Mode which enables or disables additional recognition of color barcodes on color images.
  1600. * @return Additional recognition of color barcodes on color images.
  1601. */
  1602. getComplexBackground()
  1603. {
  1604. return this.getJavaClass().getComplexBackgroundSync();
  1605. }
  1606. /**
  1607. * Mode which enables or disables additional recognition of color barcodes on color images.
  1608. * @param value Additional recognition of color barcodes on color images.
  1609. */
  1610. setComplexBackground(value)
  1611. {
  1612. this.getJavaClass().setComplexBackgroundSync(value);
  1613. }
  1614. /**
  1615. * <p>
  1616. * Allows engine to recognize barcodes which has incorrect checksumm or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text.
  1617. * @return Allows engine to recognize incorrect barcodes.
  1618. */
  1619. getAllowIncorrectBarcodes()
  1620. {
  1621. return this.getJavaClass().getAllowIncorrectBarcodesSync();
  1622. }
  1623. /**
  1624. * <p>
  1625. * Allows engine to recognize barcodes which has incorrect checksumm or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text.
  1626. * @param value Allows engine to recognize incorrect barcodes.
  1627. */
  1628. setAllowIncorrectBarcodes(value)
  1629. {
  1630. this.getJavaClass().setAllowIncorrectBarcodesSync(value);
  1631. }
  1632. }
  1633. /**
  1634. * Contains the data of subtype for Code128 type barcode
  1635. */
  1636. class Code128DataPortion extends joint.BaseJavaClass
  1637. {
  1638. /**
  1639. * Creates a new instance of the {@code Code128DataPortion} class with start code symbol and decoded codetext.
  1640. */
  1641. constructor(javaclass)
  1642. {
  1643. super(javaclass);
  1644. this.init()
  1645. }
  1646. init()
  1647. {
  1648. }
  1649. /**
  1650. * Gets the part of code text related to subtype.
  1651. *
  1652. * @return The part of code text related to subtype
  1653. */
  1654. getData()
  1655. {
  1656. return this.getJavaClass().getDataSync();
  1657. }
  1658. /**
  1659. * Gets the type of Code128 subset
  1660. *
  1661. * @return The type of Code128 subset
  1662. */
  1663. getCode128SubType()
  1664. {
  1665. return this.getJavaClass().getCode128SubTypeSync();
  1666. }
  1667. /**
  1668. * Returns a human-readable string representation of this {@code Code128DataPortion}.
  1669. * @return A string that represents this {@code Code128DataPortion}.
  1670. */
  1671. toString()
  1672. {
  1673. return this.getJavaClass().toStringSync();
  1674. }
  1675. }
  1676. /**
  1677. * Stores a DataBar additional information of recognized barcode
  1678. *@example
  1679. * let reader = new BarCodeReader("c:\\test.png", DecodeType.DATABAR_OMNI_DIRECTIONAL);
  1680. * reader.readBarCodes().forEach(function(result, i, results)
  1681. * {
  1682. * console.log("BarCode Type: " + result.getCodeTypeName());
  1683. * console.log("BarCode CodeText: " + result.getCodeText());
  1684. * console.log("QR Structured Append Quantity: " + result.getExtended().getQR().getQRStructuredAppendModeBarCodesQuantity());
  1685. * });
  1686. */
  1687. class DataBarExtendedParameters extends joint.BaseJavaClass
  1688. {
  1689. init()
  1690. {
  1691. }
  1692. /**
  1693. * Gets the DataBar 2D composite component flag. Default value is false.
  1694. * @return The DataBar 2D composite component flag.
  1695. */
  1696. is2DCompositeComponent()
  1697. {
  1698. return this.getJavaClass().is2DCompositeComponentSync();
  1699. }
  1700. /**
  1701. * Returns a value indicating whether this instance is equal to a specified DataBarExtendedParameters value.<br>
  1702. * @param obj DataBarExtendedParameters value to compare to this instance.<br>
  1703. * @return true if obj has the same value as this instance; otherwise, false<br>.
  1704. */
  1705. equals(obj)
  1706. {
  1707. return this.getJavaClass().equalsSync(obj.getJavaClass());
  1708. }
  1709. /**
  1710. * Returns the hash code for this instance.
  1711. * @return A 32-bit signed integer hash code.
  1712. */
  1713. hashcode()
  1714. {
  1715. return this.getJavaClass().hashcodeSync();
  1716. }
  1717. /**
  1718. * Returns a human-readable string representation of this <see cref="DataBarExtendedParameters"/>.
  1719. * @return A string that represents this <see cref="DataBarExtendedParameters"/>.
  1720. */
  1721. toString()
  1722. {
  1723. return this.getJavaClass().toStringSync();
  1724. }
  1725. }
  1726. /**
  1727. * AustraliaPost decoding parameters. Contains parameters which make influence on recognized data of AustraliaPost symbology.
  1728. */
  1729. class AustraliaPostSettings extends joint.BaseJavaClass
  1730. {
  1731. /**
  1732. * AustraliaPostSettings constructor
  1733. */
  1734. constructor(javaclass)
  1735. {
  1736. super(javaclass);
  1737. this.init()
  1738. }
  1739. init()
  1740. {
  1741. }
  1742. /**
  1743. * Gets the Interpreting Type for the Customer Information of AustralianPost BarCode.DEFAULT is CustomerInformationInterpretingType.OTHER.
  1744. * @return The interpreting type (CTable, NTable or Other) of customer information for AustralianPost BarCode
  1745. */
  1746. getCustomerInformationInterpretingType()
  1747. {
  1748. return this.getJavaClass().getCustomerInformationInterpretingTypeSync();
  1749. }
  1750. /**
  1751. * Sets the Interpreting Type for the Customer Information of AustralianPost BarCode.DEFAULT is CustomerInformationInterpretingType.OTHER.<br>
  1752. * @param value The interpreting type (CTable, NTable or Other) of customer information for AustralianPost BarCode
  1753. */
  1754. setCustomerInformationInterpretingType(value)
  1755. {
  1756. this.getJavaClass().setCustomerInformationInterpretingTypeSync(value);
  1757. }
  1758. /**
  1759. * The flag which force AustraliaPost decoder to ignore last filling patterns in Customer Information Field during decoding as CTable method.<br>
  1760. * CTable encoding method does not have any gaps in encoding table and sequnce "333" of filling paterns is decoded as letter "z".
  1761. *
  1762. * @example
  1763. *
  1764. * let generator = new BarcodeGenerator(EncodeTypes.AUSTRALIA_POST, "5912345678AB");
  1765. * generator.getParameters().getBarcode().getAustralianPost().setAustralianPostEncodingTable(CustomerInformationInterpretingType.C_TABLE);
  1766. * let image = generator.generateBarCodeImage(BarcodeImageFormat.PNG);
  1767. * let reader = new BarCodeReader(image, null, DecodeType.AUSTRALIA_POST);
  1768. * reader.getBarcodeSettings().getAustraliaPost().setCustomerInformationInterpretingType(CustomerInformationInterpretingType.C_TABLE);
  1769. * reader.getBarcodeSettings().getAustraliaPost().setIgnoreEndingFillingPatternsForCTable(true);
  1770. * reader.readBarCodes().forEach(function(result, i, results)
  1771. * {
  1772. * console.log("BarCode Type: " + result.getCodeType());
  1773. * console.log("BarCode CodeText: " + result.getCodeText());
  1774. * });
  1775. *
  1776. * @return The flag which force AustraliaPost decoder to ignore last filling patterns during CTable method decoding
  1777. */
  1778. getIgnoreEndingFillingPatternsForCTable()
  1779. {
  1780. return this.getJavaClass().getIgnoreEndingFillingPatternsForCTableSync();
  1781. }
  1782. /**
  1783. * The flag which force AustraliaPost decoder to ignore last filling patterns in Customer Information Field during decoding as CTable method.<br>
  1784. * CTable encoding method does not have any gaps in encoding table and sequnce "333" of filling paterns is decoded as letter "z".
  1785. *
  1786. * @example
  1787. *
  1788. * let generator = new BarcodeGenerator(EncodeTypes.AUSTRALIA_POST, "5912345678AB");
  1789. * generator.getParameters().getBarcode().getAustralianPost().setAustralianPostEncodingTable(CustomerInformationInterpretingType.C_TABLE);
  1790. * let image = generator.generateBarCodeImage(BarcodeImageFormat.PNG);
  1791. * let reader = new BarCodeReader(image, null, DecodeType.AUSTRALIA_POST);
  1792. * reader.getBarcodeSettings().getAustraliaPost().setCustomerInformationInterpretingType(CustomerInformationInterpretingType.C_TABLE);
  1793. * reader.getBarcodeSettings().getAustraliaPost().setIgnoreEndingFillingPatternsForCTable(true);
  1794. * reader.readBarCodes().forEach(function(result, i, results)
  1795. * {
  1796. * console.log("BarCode Type: " + result.getCodeType());
  1797. * console.log("BarCode CodeText: " + result.getCodeText());
  1798. * });
  1799. *
  1800. * @return The flag which force AustraliaPost decoder to ignore last filling patterns during CTable method decoding
  1801. */
  1802. setIgnoreEndingFillingPatternsForCTable(value)
  1803. {
  1804. this.getJavaClass().setIgnoreEndingFillingPatternsForCTableSync(value);
  1805. }
  1806. }
  1807. /**
  1808. * The main BarCode decoding parameters. Contains parameters which make influence on recognized data.
  1809. */
  1810. class BarcodeSettings extends joint.BaseJavaClass
  1811. {
  1812. _australiaPost;
  1813. /**
  1814. * BarcodeSettings copy constructor
  1815. * @param settings The source of the data
  1816. */
  1817. constructor(javaclass)
  1818. {
  1819. super(javaclass);
  1820. this.init()
  1821. }
  1822. init()
  1823. {
  1824. this._australiaPost = new AustraliaPostSettings(this.getJavaClass().getAustraliaPostSync());
  1825. }
  1826. /**
  1827. * Enable checksum validation during recognition for 1D and Postal barcodes.<br>
  1828. * Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.<br>
  1829. * Checksum never used: Codabar, PatchCode, Pharmacode, DataLogic2of5<br>
  1830. * Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, ItalianPost25, Matrix2of5, MSI, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN<br>
  1831. * Checksum always used: Rest symbologies<br>
  1832. *
  1833. * @example
  1834. *
  1835. * let generator = new BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128");
  1836. * generator.save("c:/test.png", BarcodeImageFormat.PNG);
  1837. * let reader = new BarCodeReader("c:/test.png", DecodeType.EAN_13);
  1838. * //checksum disabled
  1839. * reader.getBarcodeSettings().setChecksumValidation(ChecksumValidation.OFF);
  1840. * reader.readBarCodes().forEach(function(result, i, results)
  1841. * {
  1842. * console.log ("BarCode CodeText: " + result.getCodeText());
  1843. * console.log ("BarCode Value: " + result.getExtended().getOneD().getValue());
  1844. * console.log ("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum());
  1845. * });
  1846. *
  1847. * @example
  1848. * let reader = new BarCodeReader("c:/test.png", DecodeType.EAN_13);
  1849. * //checksum enabled
  1850. * reader.getBarcodeSettings().setChecksumValidation(ChecksumValidation.ON);
  1851. * reader.readBarCodes().forEach(function(result, i, results)
  1852. * {
  1853. * console.log ("BarCode CodeText: " + result.CodeText);
  1854. * console.log ("BarCode Value: " + result.getExtended().getOneD().getValue());
  1855. * console.log ("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum());
  1856. * });
  1857. * @return Enable checksum validation during recognition for 1D and Postal barcodes.
  1858. */
  1859. getChecksumValidation()
  1860. {
  1861. return this.getJavaClass().getChecksumValidationSync();
  1862. }
  1863. /**
  1864. * Enable checksum validation during recognition for 1D and Postal barcodes.<br>
  1865. * Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.<br>
  1866. * Checksum never used: Codabar, PatchCode, Pharmacode, DataLogic2of5<br>
  1867. * Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, ItalianPost25, Matrix2of5, MSI, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN<br>
  1868. * Checksum always used: Rest symbologies<br>
  1869. *
  1870. * @example
  1871. *
  1872. * let generator = new BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128");
  1873. * generator.save("c:/test.png", BarcodeImageFormat.PNG);
  1874. * let reader = new BarCodeReader("c:/test.png", DecodeType.EAN_13);
  1875. * //checksum disabled
  1876. * reader.getBarcodeSettings().setChecksumValidation(ChecksumValidation.OFF);
  1877. * reader.readBarCodes().forEach(function(result, i, results)
  1878. * {
  1879. * console.log ("BarCode CodeText: " + result.getCodeText());
  1880. * console.log ("BarCode Value: " + result.getExtended().getOneD().getValue());
  1881. * console.log ("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum());
  1882. * });
  1883. *
  1884. * @example
  1885. * let reader = new BarCodeReader("c:/test.png", DecodeType.EAN_13);
  1886. * //checksum enabled
  1887. * reader.getBarcodeSettings().setChecksumValidation(ChecksumValidation.ON);
  1888. * reader.readBarCodes().forEach(function(result, i, results)
  1889. * {
  1890. * console.log ("BarCode CodeText: " + result.CodeText);
  1891. * console.log ("BarCode Value: " + result.getExtended().getOneD().getValue());
  1892. * console.log ("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum());
  1893. * });
  1894. * @param value Enable checksum validation during recognition for 1D and Postal barcodes.
  1895. */
  1896. setChecksumValidation(value)
  1897. {
  1898. this.getJavaClass().setChecksumValidationSync(value);
  1899. }
  1900. /**
  1901. * Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false.
  1902. *
  1903. * @example
  1904. *
  1905. * let generator = new BarcodeGenerator(EncodeTypes.GS_1_CODE_128, "(02)04006664241007(37)1(400)7019590754");
  1906. * generator.save("c:/test.png", BarcodeImageFormat.PNG);
  1907. * let reader = new BarCodeReader("c:/test.png", DecodeType.CODE_128);
  1908. *
  1909. * //StripFNC disabled
  1910. * reader.getBarcodeSettings().setStripFNC(false);
  1911. * reader.readBarCodes().forEach(function(result, i, results)
  1912. * {
  1913. * console.log ("BarCode CodeText: " + result.getCodeText());
  1914. * });
  1915. *
  1916. * @example
  1917. * let reader = new BarCodeReader("c:/test.png", DecodeType.CODE_128);
  1918. *
  1919. * //StripFNC enabled
  1920. * reader.getBarcodeSettings().setStripFNC(true);
  1921. * reader.readBarCodes().forEach(function(result, i, results)
  1922. * {
  1923. * console.log ("BarCode CodeText: " + result.getCodeText());
  1924. * });
  1925. *
  1926. * @return Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false.
  1927. */
  1928. getStripFNC()
  1929. {
  1930. return this.getJavaClass().getStripFNCSync();
  1931. }
  1932. /**
  1933. * Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false.
  1934. *
  1935. * @example
  1936. *
  1937. * let generator = new BarcodeGenerator(EncodeTypes.GS_1_CODE_128, "(02)04006664241007(37)1(400)7019590754");
  1938. * generator.save("c:/test.png", BarcodeImageFormat.PNG);
  1939. * let reader = new BarCodeReader("c:/test.png", DecodeType.CODE_128);
  1940. *
  1941. * //StripFNC disabled
  1942. * reader.getBarcodeSettings().setStripFNC(false);
  1943. * reader.readBarCodes().forEach(function(result, i, results)
  1944. * {
  1945. * console.log ("BarCode CodeText: " + result.getCodeText());
  1946. * });
  1947. *
  1948. * @example
  1949. * let reader = new BarCodeReader("c:/test.png", DecodeType.CODE_128);
  1950. *
  1951. * //StripFNC enabled
  1952. * reader.getBarcodeSettings().setStripFNC(true);
  1953. * reader.readBarCodes().forEach(function(result, i, results)
  1954. * {
  1955. * console.log ("BarCode CodeText: " + result.getCodeText());
  1956. * });
  1957. *
  1958. * @param value Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false.
  1959. */
  1960. setStripFNC(value)
  1961. {
  1962. this.getJavaClass().setStripFNCSync(value);
  1963. }
  1964. /**
  1965. * The flag which force engine to detect codetext encoding for Unicode codesets. Default value is true.
  1966. *
  1967. * @example
  1968. *
  1969. * let generator = new BarcodeGenerator(EncodeTypes.QR, "Слово"))
  1970. * im = generator.generateBarcodeImage(BarcodeImageFormat.PNG);
  1971. *
  1972. * //detects encoding for Unicode codesets is enabled
  1973. * let reader = new BarCodeReader(im, DecodeType.QR);
  1974. * reader.getBarcodeSettings().setDetectEncoding(true);
  1975. * reader.readBarCodes().forEach(function(result, i, results)
  1976. * {
  1977. * console.log ("BarCode CodeText: " + result.getCodeText());
  1978. * });
  1979. *
  1980. * @example
  1981. * //detect encoding is disabled
  1982. * let reader = new BarCodeReader(im, DecodeType.QR);
  1983. * reader.getBarcodeSettings().setDetectEncoding(false);
  1984. * reader.readBarCodes().forEach(function(result, i, results)
  1985. * console.log ("BarCode CodeText: " + result.getCodeText());
  1986. *
  1987. * @return The flag which force engine to detect codetext encoding for Unicode codesets
  1988. */
  1989. getDetectEncoding()
  1990. {
  1991. return this.getJavaClass().getDetectEncodingSync();
  1992. }
  1993. /**
  1994. * The flag which force engine to detect codetext encoding for Unicode codesets. Default value is true.
  1995. *
  1996. * @example
  1997. *
  1998. * let generator = new BarcodeGenerator(EncodeTypes.QR, "Слово"))
  1999. * im = generator.generateBarcodeImage(BarcodeImageFormat.PNG);
  2000. *
  2001. * //detects encoding for Unicode codesets is enabled
  2002. * let reader = new BarCodeReader(im, DecodeType.QR);
  2003. * reader.getBarcodeSettings().setDetectEncoding(true);
  2004. * reader.readBarCodes().forEach(function(result, i, results)
  2005. * {
  2006. * console.log ("BarCode CodeText: " + result.getCodeText());
  2007. * });
  2008. *
  2009. * @example
  2010. * //detect encoding is disabled
  2011. * let reader = new BarCodeReader(im, DecodeType.QR);
  2012. * reader.getBarcodeSettings().setDetectEncoding(false);
  2013. * reader.readBarCodes().forEach(function(result, i, results)
  2014. * console.log ("BarCode CodeText: " + result.getCodeText());
  2015. *
  2016. * @return The flag which force engine to detect codetext encoding for Unicode codesets
  2017. */
  2018. setDetectEncoding(value)
  2019. {
  2020. this.getJavaClass().setDetectEncodingSync(value);
  2021. }
  2022. /**
  2023. * Gets AustraliaPost decoding parameters
  2024. * @return The AustraliaPost decoding parameters which make influence on recognized data of AustraliaPost symbology
  2025. */
  2026. getAustraliaPost()
  2027. {
  2028. return this._australiaPost;
  2029. }
  2030. }
  2031. /**
  2032. * Represents recognition abort exception which is thrown in timeout exceeding during recognition with BarCodeReader.
  2033. */
  2034. class RecognitionAbortedException extends Error
  2035. {
  2036. javaClass;
  2037. static get javaClassName()
  2038. {
  2039. return "com.aspose.mw.barcode.recognition.MwRecognitionAbortedException";
  2040. }
  2041. /**
  2042. * Gets the execution time of current recognition session
  2043. * @return The execution time of current recognition session
  2044. */
  2045. getExecutionTime()
  2046. {
  2047. return this.javaClass.getExecutionTimeSync();
  2048. }
  2049. /**
  2050. * Sets the execution time of current recognition session
  2051. * @param value The execution time of current recognition session
  2052. */
  2053. setExecutionTime(value)
  2054. {
  2055. this.javaClass.setExecutionTimeSync(value);
  2056. }
  2057. /**
  2058. * Initializes a new instance of the <see cref="RecognitionAbortedException" /> class with specified recognition abort message.
  2059. * @param message The error message of the exception.
  2060. * @param executionTime The execution time of current recognition session.
  2061. */
  2062. constructor(message, executionTime)
  2063. {
  2064. super(message);
  2065. let java_class_link = new java.import(RecognitionAbortedException.javaClassName);
  2066. if (message != null && executionTime != null)
  2067. {
  2068. this.javaClass = new java_class_link(message, executionTime);
  2069. }
  2070. else if (executionTime != null)
  2071. {
  2072. this.javaClass = new java_class_link(executionTime);
  2073. }
  2074. else
  2075. {
  2076. this.javaClass = new java_class_link();
  2077. }
  2078. }
  2079. static construct(javaClass)
  2080. {
  2081. let exception = new RecognitionAbortedException(null, null);
  2082. exception.javaClass = javaClass;
  2083. return exception;
  2084. }
  2085. init()
  2086. {
  2087. }
  2088. }
  2089. /**
  2090. * Stores a MaxiCode additional information of recognized barcode
  2091. */
  2092. class MaxiCodeExtendedParameters extends joint.BaseJavaClass
  2093. {
  2094. constructor(javaClass)
  2095. {
  2096. super(javaClass);
  2097. }
  2098. init()
  2099. {
  2100. }
  2101. /**
  2102. * Gets a MaxiCode encode mode.
  2103. * Default value: Mode4
  2104. */
  2105. getMaxiCodeMode()
  2106. {
  2107. return this.getJavaClass().getMaxiCodeModeSync();
  2108. }
  2109. /**
  2110. * Sets a MaxiCode encode mode.
  2111. * Default value: Mode4
  2112. */
  2113. setMaxiCodeMode(maxiCodeMode)
  2114. {
  2115. this.getJavaClass().setMaxiCodeModeSync(maxiCodeMode);
  2116. }
  2117. /**
  2118. * Gets a MaxiCode barcode id in structured append mode.
  2119. * Default value: 0
  2120. */
  2121. getMaxiCodeStructuredAppendModeBarcodeId()
  2122. {
  2123. return this.getJavaClass().getMaxiCodeStructuredAppendModeBarcodeIdSync();
  2124. }
  2125. /**
  2126. * Sets a MaxiCode barcode id in structured append mode.
  2127. * Default value: 0
  2128. */
  2129. setMaxiCodeStructuredAppendModeBarcodeId(value)
  2130. {
  2131. this.getJavaClass().setMaxiCodeStructuredAppendModeBarcodeIdSync(value);
  2132. }
  2133. /**
  2134. * Gets a MaxiCode barcodes count in structured append mode.
  2135. * Default value: -1
  2136. */
  2137. getMaxiCodeStructuredAppendModeBarcodesCount()
  2138. {
  2139. return this.getJavaClass().getMaxiCodeStructuredAppendModeBarcodesCountSync();
  2140. }
  2141. /**
  2142. * Sets a MaxiCode barcodes count in structured append mode.
  2143. * Default value: -1
  2144. */
  2145. setMaxiCodeStructuredAppendModeBarcodesCount(value)
  2146. {
  2147. this.getJavaClass().setMaxiCodeStructuredAppendModeBarcodesCountSync(value);
  2148. }
  2149. /**
  2150. * Returns a value indicating whether this instance is equal to a specified <see cref="MaxiCodeExtendedParameters"/> value.
  2151. * @param obj An Object value to compare to this instance.
  2152. * @return <b>true</b> if obj has the same value as this instance; otherwise, <b>false</b>.
  2153. */
  2154. equals(obj)
  2155. {
  2156. return this.getJavaClass().equalsSync(obj.getJavaClass());
  2157. }
  2158. /**
  2159. * Returns the hash code for this instance.
  2160. * @return A 32-bit signed integer hash code.
  2161. */
  2162. getHashCode()
  2163. {
  2164. return this.getJavaClass().getHashCodeSync();
  2165. }
  2166. /**
  2167. * Returns a human-readable string representation of this <see cref="MaxiCodeExtendedParameters"/>.
  2168. * @return A string that represents this <see cref="MaxiCodeExtendedParameters"/>.
  2169. */
  2170. toString()
  2171. {
  2172. return this.getJavaClass().toStringSync();
  2173. }
  2174. }
  2175. /**
  2176. * <p>
  2177. * Stores special data of DotCode recognized barcode
  2178. * </p>
  2179. * This sample shows how to get DotCode raw values<br>
  2180. *
  2181. * @example
  2182. * let generator = new BarcodeGenerator(EncodeTypes.DOT_CODE, "12345");
  2183. * generator.save("c:\\test.png", BarCodeImageFormat.PNG);
  2184. *
  2185. * let reader = new BarCodeReader("c:\\test.png", null, DecodeType.DOT_CODE);
  2186. * reader.readBarCodes().forEach(function(result, i, results)
  2187. * {
  2188. * print("BarCode type: " + result.getCodeTypeName());
  2189. * print("BarCode codetext: " + result.getCodeText());
  2190. * print("DotCode barcode ID: " + result.getExtended().getDotCode().getDotCodeStructuredAppendModeBarcodeId());
  2191. * print("DotCode barcodes count: " + result.getExtended().getDotCode().getDotCodeStructuredAppendModeBarcodesCount());
  2192. * });
  2193. */
  2194. class DotCodeExtendedParameters extends joint.BaseJavaClass
  2195. {
  2196. constructor(javaClass)
  2197. {
  2198. super(javaClass);
  2199. }
  2200. /**
  2201. * <p>Gets the DotCode structured append mode barcodes count. Default value is -1. Count must be a value from 1 to 35.</p>Value: The count of the DotCode structured append mode barcode.
  2202. */
  2203. getDotCodeStructuredAppendModeBarcodesCount()
  2204. { return this.getJavaClass().getDotCodeStructuredAppendModeBarcodesCountSync(); }
  2205. /**
  2206. * <p>Gets the ID of the DotCode structured append mode barcode. ID starts from 1 and must be less or equal to barcodes count. Default value is -1.</p>Value: The ID of the DotCode structured append mode barcode.
  2207. */
  2208. getDotCodeStructuredAppendModeBarcodeId()
  2209. { return this.getJavaClass().getDotCodeStructuredAppendModeBarcodeIdSync(); }
  2210. /**
  2211. * <p>
  2212. * Indicates whether code is used for instruct reader to interpret the following data as instructions for initialization or reprogramming of the bar code reader.
  2213. * Default value is false.
  2214. * </p>
  2215. */
  2216. getDotCodeIsReaderInitialization()
  2217. { return this.getJavaClass().getDotCodeIsReaderInitializationSync(); }
  2218. /**
  2219. * <p>
  2220. * Returns a value indicating whether this instance is equal to a specified {@code DotCodeExtendedParameters} value.
  2221. * </p>
  2222. * @return {@code <b>true</b>} if obj has the same value as this instance; otherwise, {@code <b>false</b>}.
  2223. * @param obj An System.Object value to compare to this instance.
  2224. */
  2225. equals(obj)
  2226. {
  2227. return this.getJavaClass().equalsSync(obj.getJavaClass());
  2228. }
  2229. /**
  2230. * <p>
  2231. * Returns the hash code for this instance.
  2232. * </p>
  2233. * @return A 32-bit signed integer hash code.
  2234. */
  2235. hashCode()
  2236. {
  2237. return this.getJavaClass().hashCodeSync();
  2238. }
  2239. /**
  2240. * <p>
  2241. * Returns a human-readable string representation of this {@code DotCodeExtendedParameters}.
  2242. * </p>
  2243. * @return A string that represents this {@code DotCodeExtendedParameters}.
  2244. */
  2245. toString()
  2246. {
  2247. return this.getJavaClass().toStringSync();
  2248. }
  2249. init()
  2250. {
  2251. }
  2252. }
  2253. /**
  2254. * <p>
  2255. * Stores special data of DataMatrix recognized barcode
  2256. * </p><p><hr><blockquote><pre>
  2257. * This sample shows how to get DataMatrix raw values
  2258. * <pre>
  2259. * let generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX, "12345"))
  2260. * generator.save("c:\\test.png", BarcodeImageFormat.PNG);
  2261. *
  2262. * let reader = new BarCodeReader("c:\\test.png", null, DecodeType.DATA_MATRIX))
  2263. * reader.readBarCodes().forEach(function(result, i, results)
  2264. * {
  2265. * console.log("BarCode type: " + result.getCodeTypeName());
  2266. * console.log("BarCode codetext: " + result.getCodeText());
  2267. * console.log("DataMatrix barcode ID: " + result.getExtended().getDataMatrix().getStructuredAppendBarcodeId());
  2268. * console.log("DataMatrix barcodes count: " + result.getExtended().getDataMatrix().getStructuredAppendBarcodesCount());
  2269. * console.log("DataMatrix file ID: " + result.getExtended().getDataMatrix().getStructuredAppendFileId());
  2270. * console.log("DataMatrix is reader programming: " + result.getExtended().getDataMatrix().isReaderProgramming());
  2271. * });
  2272. * </pre>
  2273. * </pre></blockquote></hr></p>
  2274. */
  2275. class DataMatrixExtendedParameters extends joint.BaseJavaClass
  2276. {
  2277. constructor(javaClass)
  2278. {
  2279. super(javaClass);
  2280. }
  2281. init()
  2282. {
  2283. }
  2284. /**
  2285. * <p>Gets the DataMatrix structured append mode barcodes count. Default value is -1. Count must be a value from 1 to 35.</p>Value: The count of the DataMatrix structured append mode barcode.
  2286. */
  2287. getStructuredAppendBarcodesCount()
  2288. {
  2289. return this.getJavaClass().getStructuredAppendBarcodesCountSync();
  2290. }
  2291. /**
  2292. * <p>Gets the ID of the DataMatrix structured append mode barcode. ID starts from 1 and must be less or equal to barcodes count. Default value is -1.</p>Value: The ID of the DataMatrix structured append mode barcode.
  2293. */
  2294. getStructuredAppendBarcodeId()
  2295. {
  2296. return this.getJavaClass().getStructuredAppendBarcodeIdSync();
  2297. }
  2298. /**
  2299. * <p>Gets the ID of the DataMatrix structured append mode barcode. ID starts from 1 and must be less or equal to barcodes count. Default value is -1.</p>Value: The ID of the DataMatrix structured append mode barcode.
  2300. */
  2301. getStructuredAppendFileId()
  2302. {
  2303. return this.getJavaClass().getStructuredAppendFileIdSync();
  2304. }
  2305. /**
  2306. * <p>
  2307. * Indicates whether code is used for instruct reader to interpret the following data as instructions for initialization or reprogramming of the bar code reader.
  2308. * Default value is false.
  2309. * </p>
  2310. */
  2311. isReaderProgramming()
  2312. {
  2313. return this.getJavaClass().isReaderProgrammingSync();
  2314. }
  2315. /**
  2316. * <p>
  2317. * Returns a value indicating whether this instance is equal to a specified {@code DataMatrixExtendedParameters} value.
  2318. * </p>
  2319. * @return {@code <b>true</b>} if obj has the same value as this instance; otherwise, {@code <b>false</b>}.
  2320. * @param obj An System.Object value to compare to this instance.
  2321. */
  2322. equals(obj)
  2323. {
  2324. return this.getJavaClass().equalsSync(obj.getJavaClass());
  2325. }
  2326. /**
  2327. * <p>
  2328. * Returns the hash code for this instance.
  2329. * </p>
  2330. * @return A 32-bit signed integer hash code.
  2331. */
  2332. hashCode()
  2333. {
  2334. return this.getJavaClass().hashCodeSync();
  2335. }
  2336. /**
  2337. * <p>
  2338. * Returns a human-readable string representation of this {@code DataMatrixExtendedParameters}.
  2339. * </p>
  2340. * @return A string that represents this {@code DataMatrixExtendedParameters}.
  2341. */
  2342. toString()
  2343. {
  2344. return this.getJavaClass().toStringSync();
  2345. }
  2346. }
  2347. /**
  2348. * <p>
  2349. * Stores special data of {@code <b>GS1 Composite Bar</b>} recognized barcode
  2350. * </p>
  2351. */
  2352. class GS1CompositeBarExtendedParameters extends joint.BaseJavaClass
  2353. {
  2354. constructor(javaClass)
  2355. {
  2356. super(javaClass);
  2357. }
  2358. init()
  2359. {
  2360. }
  2361. /**
  2362. * <p>Gets the 1D (linear) barcode type of GS1 Composite</p>Value: 2D barcode type
  2363. */
  2364. getOneDType()
  2365. {
  2366. return this.getJavaClass().getOneDTypeSync();
  2367. }
  2368. /**
  2369. * <p>Gets the 1D (linear) barcode value of GS1 Composite</p>Value: 1D barcode value
  2370. */
  2371. getOneDCodeText()
  2372. {
  2373. return this.getJavaClass().getOneDCodeTextSync();
  2374. }
  2375. /**
  2376. * <p>Gets the 2D barcode type of GS1 Composite</p>Value: 2D barcode type
  2377. */
  2378. getTwoDType()
  2379. {
  2380. return this.getJavaClass().getTwoDTypeSync();
  2381. }
  2382. /**
  2383. * <p>Gets the 2D barcode value of GS1 Composite</p>Value: 2D barcode value
  2384. */
  2385. getTwoDCodeText()
  2386. {
  2387. return this.getJavaClass().getTwoDCodeTextSync();
  2388. }
  2389. /**
  2390. * <p>
  2391. * Returns a value indicating whether this instance is equal to a specified {@code GS1CompositeBarExtendedParameters} value.
  2392. * </p>
  2393. * @return {@code <b>true</b>} if obj has the same value as this instance; otherwise, {@code <b>false</b>}.
  2394. * @param obj An System.Object value to compare to this instance.
  2395. */
  2396. equals(obj)
  2397. {
  2398. return this.getJavaClass().equalsSync(obj.getJavaClass());
  2399. }
  2400. /**
  2401. * <p>
  2402. * Returns the hash code for this instance.
  2403. * </p>
  2404. * @return A 32-bit signed integer hash code.
  2405. */
  2406. hashCode()
  2407. {
  2408. return this.getJavaClass().hashCodeSync();
  2409. }
  2410. /**
  2411. * <p>
  2412. * Returns a human-readable string representation of this {@code GS1CompositeBarExtendedParameters}.
  2413. * </p>
  2414. * @return A string that represents this {@code GS1CompositeBarExtendedParameters}.
  2415. */
  2416. toString()
  2417. {
  2418. return this.getJavaClass().toStringSync();
  2419. }
  2420. }
  2421. /**
  2422. * <p>
  2423. * Stores special data of Aztec recognized barcode
  2424. * </p><p><hr><blockquote><pre>
  2425. * This sample shows how to get Aztec raw values
  2426. * <pre>
  2427. * let generator = new BarcodeGenerator(EncodeTypes.AZTEC, "12345");
  2428. * generator.save("test.png", BarcodeImageFormat.PNG);
  2429. *
  2430. * @example
  2431. * BarCodeReader reader = new BarCodeReader("test.png", null, DecodeType.AZTEC);
  2432. * reader.readBarCodes().forEach(function(result, i, results)
  2433. * {
  2434. * console.log("BarCode type: " + result.getCodeTypeName());
  2435. * console.log("BarCode codetext: " + result.getCodeText());
  2436. * console.log("Aztec barcode ID: " + result.getExtended().getAztec().getStructuredAppendBarcodeId());
  2437. * console.log("Aztec barcodes count: " + result.getExtended().getAztec().getStructuredAppendBarcodesCount());
  2438. * console.log("Aztec file ID: " + result.getExtended().getAztec().getStructuredAppendFileId());
  2439. * console.log("Aztec is reader initialization: " + result.getExtended().getAztec().isReaderInitialization());
  2440. * });
  2441. * </pre>
  2442. * </pre></blockquote></hr></p>
  2443. */
  2444. class AztecExtendedParameters extends joint.BaseJavaClass
  2445. {
  2446. constructor(javaClass)
  2447. {
  2448. super(javaClass);
  2449. }
  2450. init()
  2451. {
  2452. }
  2453. /**
  2454. * <p>Gets the Aztec structured append mode barcodes count. Default value is 0. Count must be a value from 1 to 26.</p>Value: The barcodes count of the Aztec structured append mode.
  2455. */
  2456. getStructuredAppendBarcodesCount()
  2457. {
  2458. return this.getJavaClass().getStructuredAppendBarcodesCountSync();
  2459. }
  2460. /**
  2461. * <p>Gets the ID of the Aztec structured append mode barcode. ID starts from 1 and must be less or equal to barcodes count. Default value is 0.</p>Value: The barcode ID of the Aztec structured append mode.
  2462. */
  2463. getStructuredAppendBarcodeId()
  2464. {
  2465. return this.getJavaClass().getStructuredAppendBarcodeIdSync();
  2466. }
  2467. /**
  2468. * <p>Gets the File ID of the Aztec structured append mode. Default value is empty string</p>Value: The File ID of the Aztec structured append mode.
  2469. */
  2470. getStructuredAppendFileId()
  2471. {
  2472. return this.getJavaClass().getStructuredAppendFileIdSync();
  2473. }
  2474. /**
  2475. * <p>
  2476. * Indicates whether code is used for instruct reader to interpret the following data as instructions for initialization or reprogramming of the bar code reader.
  2477. * Default value is false.
  2478. * </p>
  2479. */
  2480. isReaderInitialization()
  2481. {
  2482. return this.getJavaClass().isReaderInitializationSync();
  2483. }
  2484. /**
  2485. * <p>
  2486. * Returns a value indicating whether this instance is equal to a specified {@code AztecExtendedParameters} value.
  2487. * </p>
  2488. * @return {@code <b>true</b>} if obj has the same value as this instance; otherwise, {@code <b>false</b>}.
  2489. * @param obj An System.Object value to compare to this instance.
  2490. */
  2491. equals(obj)
  2492. {
  2493. return this.getJavaClass().equalsSync(obj.getJavaClass());
  2494. }
  2495. /**
  2496. * <p>
  2497. * Returns the hash code for this instance.
  2498. * </p>
  2499. * @return 32-bit signed integer hash code.
  2500. */
  2501. hashCode()
  2502. {
  2503. return this.getJavaClass().hashCodeSync();
  2504. }
  2505. /**
  2506. * <p>
  2507. * Returns a human-readable string representation of this {@code AztecExtendedParameters}.
  2508. * </p>
  2509. * @return A string that represents this {@code AztecExtendedParameters}.
  2510. */
  2511. toString()
  2512. {
  2513. return this.getJavaClass().toStringSync();
  2514. }
  2515. }
  2516. /**
  2517. * <p>
  2518. * Stores a Codabar additional information of recognized barcode
  2519. * </p>
  2520. */
  2521. class CodabarExtendedParameters extends joint.BaseJavaClass
  2522. {
  2523. constructor(javaClass)
  2524. {
  2525. super(javaClass);
  2526. }
  2527. init()
  2528. {
  2529. }
  2530. /**
  2531. * <p>
  2532. * Gets or sets a Codabar start symbol.
  2533. * Default value: CodabarSymbol.A
  2534. * </p>
  2535. */
  2536. getCodabarStartSymbol()
  2537. {
  2538. return this.getJavaClass().getCodabarStartSymbolSync();
  2539. }
  2540. /**
  2541. * <p>
  2542. * Gets or sets a Codabar start symbol.
  2543. * Default value: CodabarSymbol.A
  2544. * </p>
  2545. */
  2546. setCodabarStartSymbol(value)
  2547. {
  2548. this.getJavaClass().setCodabarStartSymbolSync(value);
  2549. }
  2550. /**
  2551. * <p>
  2552. * Gets or sets a Codabar stop symbol.
  2553. * Default value: CodabarSymbol.A
  2554. * </p>
  2555. */
  2556. getCodabarStopSymbol()
  2557. {
  2558. return this.getJavaClass().getCodabarStopSymbolSync();
  2559. }
  2560. /**
  2561. * <p>
  2562. * Gets or sets a Codabar stop symbol.
  2563. * Default value: CodabarSymbol.A
  2564. * </p>
  2565. */
  2566. setCodabarStopSymbol(value)
  2567. {
  2568. this.getJavaClass().setCodabarStopSymbolSync(value);
  2569. }
  2570. /**
  2571. * <p>
  2572. * Returns a value indicating whether this instance is equal to a specified {@code CodabarExtendedParameters} value.
  2573. * </p>
  2574. * @return {@code <b>true</b>} if obj has the same value as this instance; otherwise, {@code <b>false</b>}.
  2575. * @param obj An System.Object value to compare to this instance.
  2576. */
  2577. equals(obj)
  2578. {
  2579. return this.getJavaClass().equalsSync(obj.getJavaClass());
  2580. }
  2581. /**
  2582. * <p>
  2583. * Returns the hash code for this instance.
  2584. * </p>
  2585. * @return A 32-bit signed integer hash code.
  2586. */
  2587. hashCode()
  2588. {
  2589. return this.getJavaClass().hashCodeSync();
  2590. }
  2591. /**
  2592. * <p>
  2593. * Returns a human-readable string representation of this {@code CodabarExtendedParameters}.
  2594. * </p>
  2595. * @return A string that represents this {@code CodabarExtendedParameters}.
  2596. */
  2597. toString()
  2598. {
  2599. return this.getJavaClass().toStringSync();
  2600. }
  2601. }
  2602. /**
  2603. * Specify the type of barcode to read.
  2604. *
  2605. * @example
  2606. * //This sample shows how to detect Code39 and Code128 barcodes.
  2607. * let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
  2608. * reader.readBarCodes().forEach(function(result, i, results)
  2609. * {
  2610. * console.log("BarCode Type: " + result.getCodeTypeName());
  2611. * console.log("BarCode CodeText: " + result.getCodeText());
  2612. * });
  2613. *
  2614. * @enum
  2615. */
  2616. DecodeType =
  2617. {
  2618. /**
  2619. * Unspecified decode type.
  2620. */
  2621. NONE: -1,
  2622. /**
  2623. * Specifies that the data should be decoded with {@code <b>CODABAR</b>} barcode specification
  2624. */
  2625. CODABAR: 0,
  2626. /**
  2627. * Specifies that the data should be decoded with {@code <b>CODE 11</b>} barcode specification
  2628. */
  2629. CODE_11: 1,
  2630. /**
  2631. * <p>
  2632. * Specifies that the data should be decoded with {@code <b>Code 39</b>} basic charset barcode specification: ISO/IEC 16388
  2633. * </p>
  2634. */
  2635. CODE_39: 2,
  2636. /**
  2637. * <p>
  2638. * Specifies that the data should be decoded with {@code <b>Code 39</b>} full ASCII charset barcode specification: ISO/IEC 16388
  2639. * </p>
  2640. */
  2641. CODE_39_FULL_ASCII: 3,
  2642. /**
  2643. * <p>
  2644. * Specifies that the data should be decoded with {@code <b>CODE 93</b>} barcode specification
  2645. * </p>
  2646. */
  2647. CODE_93: 5,
  2648. /**
  2649. * Specifies that the data should be decoded with {@code <b>CODE 128</b>} barcode specification
  2650. */
  2651. CODE_128: 6,
  2652. /**
  2653. * Specifies that the data should be decoded with {@code <b>GS1 CODE 128</b>} barcode specification
  2654. */
  2655. GS_1_CODE_128: 7,
  2656. /**
  2657. * Specifies that the data should be decoded with {@code <b>EAN-8</b>} barcode specification
  2658. */
  2659. EAN_8: 8,
  2660. /**
  2661. * Specifies that the data should be decoded with {@code <b>EAN-13</b>} barcode specification
  2662. */
  2663. EAN_13: 9,
  2664. /**
  2665. * Specifies that the data should be decoded with {@code <b>EAN14</b>} barcode specification
  2666. */
  2667. EAN_14: 10,
  2668. /**
  2669. * Specifies that the data should be decoded with {@code <b>SCC14</b>} barcode specification
  2670. */
  2671. SCC_14: 11,
  2672. /**
  2673. * Specifies that the data should be decoded with {@code <b>SSCC18</b>} barcode specification
  2674. */
  2675. SSCC_18: 12,
  2676. /**
  2677. * Specifies that the data should be decoded with {@code <b>UPC-A</b>} barcode specification
  2678. */
  2679. UPCA: 13,
  2680. /**
  2681. * Specifies that the data should be decoded with {@code <b>UPC-E</b>} barcode specification
  2682. */
  2683. UPCE: 14,
  2684. /**
  2685. * Specifies that the data should be decoded with {@code <b>ISBN</b>} barcode specification
  2686. */
  2687. ISBN: 15,
  2688. /**
  2689. * Specifies that the data should be decoded with {@code <b>Standard 2 of 5</b>} barcode specification
  2690. */
  2691. STANDARD_2_OF_5: 16,
  2692. /**
  2693. * Specifies that the data should be decoded with {@code <b>INTERLEAVED 2 of 5</b>} barcode specification
  2694. */
  2695. INTERLEAVED_2_OF_5: 17,
  2696. /**
  2697. * Specifies that the data should be decoded with {@code <b>Matrix 2 of 5</b>} barcode specification
  2698. */
  2699. MATRIX_2_OF_5: 18,
  2700. /**
  2701. * Specifies that the data should be decoded with {@code <b>Italian Post 25</b>} barcode specification
  2702. */
  2703. ITALIAN_POST_25: 19,
  2704. /**
  2705. * Specifies that the data should be decoded with {@code <b>IATA 2 of 5</b>} barcode specification. IATA (International Air Transport Association) uses this barcode for the management of air cargo.
  2706. */
  2707. IATA_2_OF_5: 20,
  2708. /**
  2709. * Specifies that the data should be decoded with {@code <b>ITF14</b>} barcode specification
  2710. */
  2711. ITF_14: 21,
  2712. /**
  2713. * Specifies that the data should be decoded with {@code <b>ITF6</b>} barcode specification
  2714. */
  2715. ITF_6: 22,
  2716. /**
  2717. * Specifies that the data should be decoded with {@code <b>MSI Plessey</b>} barcode specification
  2718. */
  2719. MSI: 23,
  2720. /**
  2721. * Specifies that the data should be decoded with {@code <b>VIN</b>} (Vehicle Identification Number) barcode specification
  2722. */
  2723. VIN: 24,
  2724. /**
  2725. * Specifies that the data should be decoded with {@code <b>DeutschePost Ident code</b>} barcode specification
  2726. */
  2727. DEUTSCHE_POST_IDENTCODE: 25,
  2728. /**
  2729. * Specifies that the data should be decoded with {@code <b>DeutschePost Leit code</b>} barcode specification
  2730. */
  2731. DEUTSCHE_POST_LEITCODE: 26,
  2732. /**
  2733. * Specifies that the data should be decoded with {@code <b>OPC</b>} barcode specification
  2734. */
  2735. OPC: 27,
  2736. /**
  2737. * Specifies that the data should be decoded with {@code <b>PZN</b>} barcode specification. This symbology is also known as Pharma Zentral Nummer
  2738. */
  2739. PZN: 28,
  2740. /**
  2741. * Specifies that the data should be decoded with {@code <b>Pharmacode</b>} barcode. This symbology is also known as Pharmaceutical BINARY Code
  2742. */
  2743. PHARMACODE: 29,
  2744. /**
  2745. * Specifies that the data should be decoded with {@code <b>DataMatrix</b>} barcode symbology
  2746. */
  2747. DATA_MATRIX: 30,
  2748. /**
  2749. * Specifies that the data should be decoded with {@code <b>GS1DataMatrix</b>} barcode symbology
  2750. */
  2751. GS_1_DATA_MATRIX: 31,
  2752. /**
  2753. * Specifies that the data should be decoded with {@code <b>QR Code</b>} barcode specification
  2754. */
  2755. QR: 32,
  2756. /**
  2757. * Specifies that the data should be decoded with {@code <b>Aztec</b>} barcode specification
  2758. */
  2759. AZTEC: 33,
  2760. /**
  2761. * <p>
  2762. * Specifies that the data should be decoded with {@code <b>GS1 Aztec</b>} barcode specification
  2763. * </p>
  2764. */
  2765. GS_1_AZTEC: 81,
  2766. /**
  2767. * Specifies that the data should be decoded with {@code <b>Pdf417</b>} barcode symbology
  2768. */
  2769. PDF_417: 34,
  2770. /**
  2771. * Specifies that the data should be decoded with {@code <b>MacroPdf417</b>} barcode specification
  2772. */
  2773. MACRO_PDF_417: 35,
  2774. /**
  2775. * Specifies that the data should be decoded with {@code <b>MicroPdf417</b>} barcode specification
  2776. */
  2777. MICRO_PDF_417: 36,
  2778. /**
  2779. * Specifies that the data should be decoded with <b>MicroPdf417</b> barcode specification
  2780. */
  2781. GS_1_MICRO_PDF_417: 82,
  2782. /**
  2783. * Specifies that the data should be decoded with {@code <b>CodablockF</b>} barcode specification
  2784. */
  2785. CODABLOCK_F: 65,
  2786. /**
  2787. * Specifies that the data should be decoded with <b>Royal Mail Mailmark</b> barcode specification.
  2788. */
  2789. MAILMARK: 66,
  2790. /**
  2791. * Specifies that the data should be decoded with {@code <b>Australia Post</b>} barcode specification
  2792. */
  2793. AUSTRALIA_POST: 37,
  2794. /**
  2795. * Specifies that the data should be decoded with {@code <b>Postnet</b>} barcode specification
  2796. */
  2797. POSTNET: 38,
  2798. /**
  2799. * Specifies that the data should be decoded with {@code <b>Planet</b>} barcode specification
  2800. */
  2801. PLANET: 39,
  2802. /**
  2803. * Specifies that the data should be decoded with USPS {@code <b>OneCode</b>} barcode specification
  2804. */
  2805. ONE_CODE: 40,
  2806. /**
  2807. * Specifies that the data should be decoded with {@code <b>RM4SCC</b>} barcode specification. RM4SCC (Royal Mail 4-state Customer Code) is used for automated mail sort process in UK.
  2808. */
  2809. RM_4_SCC: 41,
  2810. /**
  2811. * Specifies that the data should be decoded with {@code <b>GS1 DATABAR omni-directional</b>} barcode specification
  2812. */
  2813. DATABAR_OMNI_DIRECTIONAL: 42,
  2814. /**
  2815. * Specifies that the data should be decoded with {@code <b>GS1 DATABAR truncated</b>} barcode specification
  2816. */
  2817. DATABAR_TRUNCATED: 43,
  2818. /**
  2819. * Specifies that the data should be decoded with {@code <b>GS1 DATABAR limited</b>} barcode specification
  2820. */
  2821. DATABAR_LIMITED: 44,
  2822. /**
  2823. * Specifies that the data should be decoded with {@code <b>GS1 DATABAR expanded</b>} barcode specification
  2824. */
  2825. DATABAR_EXPANDED: 45,
  2826. /**
  2827. * Specifies that the data should be decoded with {@code <b>GS1 DATABAR stacked omni-directional</b>} barcode specification
  2828. */
  2829. DATABAR_STACKED_OMNI_DIRECTIONAL: 53,
  2830. /**
  2831. * Specifies that the data should be decoded with {@code <b>GS1 DATABAR stacked</b>} barcode specification
  2832. */
  2833. DATABAR_STACKED: 54,
  2834. /**
  2835. * Specifies that the data should be decoded with {@code <b>GS1 DATABAR expanded stacked</b>} barcode specification
  2836. */
  2837. DATABAR_EXPANDED_STACKED: 55,
  2838. /**
  2839. * Specifies that the data should be decoded with {@code <b>Patch code</b>} barcode specification. Barcode symbology is used for automated scanning
  2840. */
  2841. PATCH_CODE: 46,
  2842. /**
  2843. * Specifies that the data should be decoded with {@code <b>ISSN</b>} barcode specification
  2844. */
  2845. ISSN: 47,
  2846. /**
  2847. * Specifies that the data should be decoded with {@code <b>ISMN</b>} barcode specification
  2848. */
  2849. ISMN: 48,
  2850. /**
  2851. * Specifies that the data should be decoded with {@code <b>Supplement(EAN2, EAN5)</b>} barcode specification
  2852. */
  2853. SUPPLEMENT: 49,
  2854. /**
  2855. * Specifies that the data should be decoded with {@code <b>Australian Post Domestic eParcel Barcode</b>} barcode specification
  2856. */
  2857. AUSTRALIAN_POSTE_PARCEL: 50,
  2858. /**
  2859. * Specifies that the data should be decoded with {@code <b>Swiss Post Parcel Barcode</b>} barcode specification
  2860. */
  2861. SWISS_POST_PARCEL: 51,
  2862. /**
  2863. * Specifies that the data should be decoded with {@code <b>SCode16K</b>} barcode specification
  2864. */
  2865. CODE_16_K: 52,
  2866. /**
  2867. * Specifies that the data should be decoded with {@code <b>MicroQR Code</b>} barcode specification
  2868. */
  2869. MICRO_QR: 56,
  2870. /**
  2871. * Specifies that the data should be decoded with <b>RectMicroQR (rMQR) Code</b> barcode specification
  2872. */
  2873. RECT_MICRO_QR: 83,
  2874. /**
  2875. * Specifies that the data should be decoded with {@code <b>CompactPdf417</b>} (Pdf417Truncated) barcode specification
  2876. */
  2877. COMPACT_PDF_417: 57,
  2878. /**
  2879. * Specifies that the data should be decoded with {@code <b>GS1 QR</b>} barcode specification
  2880. */
  2881. GS_1_QR: 58,
  2882. /**
  2883. * Specifies that the data should be decoded with {@code <b>MaxiCode</b>} barcode specification
  2884. */
  2885. MAXI_CODE: 59,
  2886. /**
  2887. * Specifies that the data should be decoded with {@code <b>MICR E-13B</b>} blank specification
  2888. */
  2889. MICR_E_13_B: 60,
  2890. /**
  2891. * Specifies that the data should be decoded with {@code <b>Code32</b>} blank specification
  2892. */
  2893. CODE_32: 61,
  2894. /**
  2895. * Specifies that the data should be decoded with {@code <b>DataLogic 2 of 5</b>} blank specification
  2896. */
  2897. DATA_LOGIC_2_OF_5: 62,
  2898. /**
  2899. * Specifies that the data should be decoded with {@code <b>DotCode</b>} blank specification
  2900. */
  2901. DOT_CODE: 63,
  2902. /**
  2903. * <p>
  2904. * Specifies that the data should be decoded with {@code <b>GS1 DotCode</b>} blank specification
  2905. * </p>
  2906. */
  2907. GS_1_DOT_CODE: 77,
  2908. /**
  2909. * Specifies that the data should be decoded with {@code <b>DotCode</b>} blank specification
  2910. */
  2911. DUTCH_KIX: 64,
  2912. /**
  2913. * <p>
  2914. * Specifies that the data should be decoded with {@code <b>HIBC LIC Code39</b>} blank specification
  2915. * </p>
  2916. */
  2917. HIBC_CODE_39_LIC: 67,
  2918. /**
  2919. * <p>
  2920. * Specifies that the data should be decoded with {@code <b>HIBC LIC Code128</b>} blank specification
  2921. * </p>
  2922. */
  2923. HIBC_CODE_128_LIC: 68,
  2924. /**
  2925. * <p>
  2926. * Specifies that the data should be decoded with {@code <b>HIBC LIC Aztec</b>} blank specification
  2927. * </p>
  2928. */
  2929. HIBC_AZTEC_LIC: 69,
  2930. /**
  2931. * <p>
  2932. * Specifies that the data should be decoded with {@code <b>HIBC LIC DataMatrix</b>} blank specification
  2933. * </p>
  2934. */
  2935. HIBC_DATA_MATRIX_LIC: 70,
  2936. /**
  2937. * <p>
  2938. * Specifies that the data should be decoded with {@code <b>HIBC LIC QR</b>} blank specification
  2939. * </p>
  2940. */
  2941. HIBCQRLIC: 71,
  2942. /**
  2943. * <p>
  2944. * Specifies that the data should be decoded with {@code <b>HIBC PAS Code39</b>} blank specification
  2945. * </p>
  2946. */
  2947. HIBC_CODE_39_PAS: 72,
  2948. /**
  2949. * <p>
  2950. * Specifies that the data should be decoded with {@code <b>HIBC PAS Code128</b>} blank specification
  2951. * </p>
  2952. */
  2953. HIBC_CODE_128_PAS: 73,
  2954. /**
  2955. * <p>
  2956. * Specifies that the data should be decoded with {@code <b>HIBC PAS Aztec</b>} blank specification
  2957. * </p>
  2958. */
  2959. HIBC_AZTEC_PAS: 74,
  2960. /**
  2961. * <p>
  2962. * Specifies that the data should be decoded with {@code <b>HIBC PAS DataMatrix</b>} blank specification
  2963. * </p>
  2964. */
  2965. HIBC_DATA_MATRIX_PAS: 75,
  2966. /**
  2967. * <p>
  2968. * Specifies that the data should be decoded with {@code <b>HIBC PAS QR</b>} blank specification
  2969. * </p>
  2970. */
  2971. HIBCQRPAS: 76,
  2972. /**
  2973. * Specifies that the data should be decoded with <b>Han Xin Code</b> blank specification
  2974. */
  2975. HAN_XIN: 78,
  2976. /**
  2977. * Specifies that the data should be decoded with <b>Han Xin Code</b> blank specification
  2978. */
  2979. GS_1_HAN_XIN: 79,
  2980. /**
  2981. * <p>
  2982. * Specifies that the data should be decoded with {@code <b>GS1 Composite Bar</b>} barcode specification
  2983. * </p>
  2984. */
  2985. GS_1_COMPOSITE_BAR: 80,
  2986. /**
  2987. * Specifies that data will be checked with all of 1D barcode symbologies
  2988. */
  2989. TYPES_1D: 97,
  2990. /**
  2991. * Specifies that data will be checked with all of 1.5D POSTAL barcode symbologies, like Planet, Postnet, AustraliaPost, OneCode, RM4SCC, DutchKIX
  2992. */
  2993. POSTAL_TYPES: 95,
  2994. /**
  2995. * Specifies that data will be checked with most commonly used symbologies
  2996. */
  2997. MOST_COMMON_TYPES: 96,
  2998. /**
  2999. * Specifies that data will be checked with all of <b>2D</b> barcode symbologies
  3000. */
  3001. TYPES_2D: 98,
  3002. /**
  3003. * Specifies that data will be checked with all available symbologies
  3004. */
  3005. ALL_SUPPORTED_TYPES: 99,
  3006. javaClassName: "com.aspose.mw.barcode.recognition.MwDecodeTypeUtils",
  3007. /**
  3008. * Determines if the specified BaseDecodeType contains any 1D barcode symbology
  3009. * @param symbology
  3010. * @return true if BaseDecodeType contains any 1D barcode symbology; otherwise, returns false
  3011. */
  3012. is1D(symbology)
  3013. {
  3014. let javaClass = new java(DecodeType.javaClassName);
  3015. return javaClass.is1DSync(symbology);
  3016. },
  3017. /**
  3018. * Determines if the specified BaseDecodeType contains any Postal barcode symbology
  3019. * @param symbology BaseDecodeType to test
  3020. * @return true if BaseDecodeType contains any Postal barcode symbology; otherwise, returns false
  3021. */
  3022. isPostal(symbology)
  3023. {
  3024. let javaClass = new java(DecodeType.javaClassName);
  3025. return javaClass.isPostalSync(symbology);
  3026. },
  3027. /**
  3028. * Determines if the specified BaseDecodeType contains any 2D barcode symbology
  3029. * @param symbology BaseDecodeType to test.
  3030. * @return true if BaseDecodeType contains any 2D barcode symbology; otherwise, returns false
  3031. */
  3032. is2D(symbology)
  3033. {
  3034. let javaClass = new java(DecodeType.javaClassName);
  3035. return javaClass.is2DSync(symbology);
  3036. },
  3037. containsAny(decodeType, ...decodeTypes)
  3038. {
  3039. let javaClass = new java(DecodeType.javaClassName);
  3040. return javaClass.containsAnySync(...decodeTypes);
  3041. }
  3042. };
  3043. /**
  3044. * Contains types of Code128 subset
  3045. * @enum
  3046. */
  3047. Code128SubType =
  3048. {
  3049. /**
  3050. * ASCII characters 00 to 95 (0–9, A–Z and control codes), special characters, and FNC 1–4 ///
  3051. */
  3052. CODE_SET_A: 1,
  3053. /**
  3054. * ASCII characters 32 to 127 (0–9, A–Z, a–z), special characters, and FNC 1–4 ///
  3055. */
  3056. CODE_SET_B: 2,
  3057. /**
  3058. * 00–99 (encodes two digits with a single code point) and FNC1 ///
  3059. */
  3060. CODE_SET_C: 3,
  3061. };
  3062. /**
  3063. * Defines the interpreting type(C_TABLE or N_TABLE) of customer information for AustralianPost BarCode.
  3064. * @example
  3065. * let generator = new BarcodeGenerator(EncodeTypes.AUSTRALIA_POST, "5912345678ABCde");
  3066. * generator.getParameters().getBarcode().getAustralianPost().setAustralianPostEncodingTable(CustomerInformationInterpretingType.C_TABLE);
  3067. * image = generator.generateBarCodeImage();
  3068. * let reader = new BarCodeReader(image, DecodeType.AUSTRALIA_POST);
  3069. * reader.setCustomerInformationInterpretingType(CustomerInformationInterpretingType.C_TABLE);
  3070. * reader.readBarCodes().forEach(function(result, i, results)
  3071. * {
  3072. * console.log("BarCode Type: " + result.getCodeType());
  3073. * console.log("BarCode CodeText: " + result.getCodeText());
  3074. * });
  3075. *
  3076. *@example
  3077. * generator = new BarcodeGenerator(EncodeTypes.AUSTRALIA_POST, "59123456781234567");
  3078. * generator.getParameters().getBarcode().getAustralianPost().setAustralianPostEncodingTable(CustomerInformationInterpretingType.N_TABLE);
  3079. * image = generator.generateBarCodeImage();
  3080. * reader = new BarCodeReader(image, DecodeType.AUSTRALIA_POST);
  3081. * reader.setCustomerInformationInterpretingType(CustomerInformationInterpretingType.N_TABLE);
  3082. * reader.readBarCodes().forEach(function(result, i, results)
  3083. * {
  3084. * console.log("BarCode Type: " + result.getCodeType());
  3085. * console.log("BarCode CodeText: " + result.getCodeText());
  3086. * });
  3087. *
  3088. * @example
  3089. * let generator = new BarcodeGenerator(EncodeTypes.AUSTRALIA_POST, "59123456780123012301230123");
  3090. * generator.getParameters().getBarcode().getAustralianPost().setAustralianPostEncodingTable(CustomerInformationInterpretingType.OTHER);
  3091. * image = generator.generateBarCodeImage();
  3092. * let reader = new BarCodeReader(image, DecodeType.AUSTRALIA_POST);
  3093. * reader.CustomerInformationInterpretingType = CustomerInformationInterpretingType.OTHER);
  3094. * reader.readBarCodes().forEach(function(result, i, results)
  3095. * {
  3096. * console.log("BarCode Type: " + result.getCodeType());
  3097. * console.log("BarCode CodeText: " + result.getCodeText());
  3098. * });
  3099. *
  3100. * @enum
  3101. */
  3102. CustomerInformationInterpretingType =
  3103. {
  3104. /**
  3105. * Use C_TABLE to interpret the customer information. Allows A..Z, a..z, 1..9, space and # sing.
  3106. *
  3107. * @example
  3108. * let generator = new BarcodeGenerator(EncodeTypes.AUSTRALIA_POST, "5912345678ABCde");
  3109. * generator.getParameters().getBarcode().getAustralianPost().setAustralianPostEncodingTable(CustomerInformationInterpretingType.C_TABLE);
  3110. * let image = generator.generateBarcodeImage(BarcodeImageFormat.PNG);
  3111. * let reader = new BarCodeReader(image, DecodeType.AUSTRALIA_POST);
  3112. * reader.setCustomerInformationInterpretingType(CustomerInformationInterpretingType.C_TABLE);
  3113. * reader.readBarCodes().forEach(function(result, i, results)
  3114. * {
  3115. * console.log("BarCode Type: " + result.getCodeType());
  3116. * console.log("BarCode CodeText: " + result.getCodeText());
  3117. * });
  3118. */
  3119. C_TABLE: 0,
  3120. /**
  3121. * Use N_TABLE to interpret the customer information. Allows digits.
  3122. *
  3123. * @example
  3124. * let generator = new BarcodeGenerator(EncodeTypes.AUSTRALIA_POST, "59123456781234567");
  3125. * generator.getParameters().getBarcode().getAustralianPost().setAustralianPostEncodingTable(CustomerInformationInterpretingType.N_TABLE);
  3126. * let image = generator.generateBarcodeImage(BarcodeImageFormat.PNG);
  3127. * let reader = new BarCodeReader(image, DecodeType.AUSTRALIA_POST);
  3128. * reader.setCustomerInformationInterpretingType(CustomerInformationInterpretingType.N_TABLE);
  3129. * reader.readBarCodes().forEach(function(result, i, results)
  3130. * {
  3131. * console.log("BarCode Type: " + result.getCodeType());
  3132. * console.log("BarCode CodeText: " + result.getCodeText());
  3133. * });
  3134. */
  3135. N_TABLE: 1,
  3136. /**
  3137. * Do not interpret the customer information. Allows 0, 1, 2 or 3 symbol only.
  3138. *
  3139. * @example
  3140. * let generator = new BarcodeGenerator(EncodeTypes.AUSTRALIA_POST, "59123456780123012301230123");
  3141. * generator.getParameters().getBarcode().getAustralianPost().setAustralianPostEncodingTable(CustomerInformationInterpretingType.OTHER);
  3142. * let image = generator.generateBarcodeImage(BarcodeImageFormat.PNG);
  3143. * let reader = new BarCodeReader(image, DecodeType.AUSTRALIA_POST);
  3144. * reader.setCustomerInformationInterpretingType(CustomerInformationInterpretingType.OTHER));
  3145. * reader.readBarCodes().forEach(function(result, i, results)
  3146. * {
  3147. * console.log("BarCode Type: " + result.getCodeType());
  3148. * console.log("BarCode CodeText: " + result.getCodeText());
  3149. * });
  3150. */
  3151. OTHER: 2,
  3152. };
  3153. /**
  3154. * Contains recognition confidence level
  3155. *
  3156. * @example
  3157. * //This sample shows how BarCodeConfidence changed, depending on barcode type
  3158. * //Moderate confidence
  3159. * let generator = new BarcodeGenerator(EncodeTypes.CODE_128, "12345");
  3160. * generator.save("test.png");
  3161. * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39, DecodeType.CODE_128]);
  3162. * reader.readBarCodes().forEach(function(result, i, results)
  3163. * {
  3164. * console.log("BarCode Type: " + result.getCodeTypeName());
  3165. * console.log("BarCode CodeText: " + result.getCodeText());
  3166. * console.log("BarCode Confidence: " + result.getConfidence());
  3167. * console.log("BarCode ReadingQuality: " + result.getReadingQuality());
  3168. * });
  3169. *
  3170. * @example
  3171. * //Strong confidence
  3172. * let generator = new BarcodeGenerator(EncodeTypes.QR, "12345");
  3173. * generator.save("test.png");
  3174. * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39, DecodeType.QR]);
  3175. * reader.readBarCodes().forEach(function(result, i, results)
  3176. * {
  3177. * console.log("BarCode Type: " + result.getCodeTypeName());
  3178. * console.log("BarCode CodeText: " + result.getCodeText());
  3179. * console.log("BarCode Confidence: " + result.getConfidence());
  3180. * console.log("BarCode ReadingQuality: " + result.getReadingQuality());
  3181. * });
  3182. *
  3183. * @enum
  3184. */
  3185. BarCodeConfidence =
  3186. {
  3187. /**
  3188. * Recognition confidence of barcode where codetext was not recognized correctly or barcode was detected as posible fake
  3189. */
  3190. NONE: 0,
  3191. /**
  3192. * Recognition confidence of barcode (mostly 1D barcodes) with weak checksumm or even without it. Could contains some misrecognitions in codetext<br>
  3193. * or even fake recognitions if is low
  3194. *
  3195. * @see BarCodeResult.ReadingQuality
  3196. */
  3197. MODERATE: 80,
  3198. /**
  3199. * Recognition confidence which was confirmed with BCH codes like Reed–Solomon. There must not be errors in read codetext or fake recognitions
  3200. */
  3201. STRONG: 100
  3202. };
  3203. /**
  3204. * Enable checksum validation during recognition for 1D barcodes.
  3205. *
  3206. * Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.
  3207. *
  3208. * Checksum never used: Codabar
  3209. *
  3210. * Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN
  3211. *
  3212. * Checksum always used: Rest symbologies
  3213. *
  3214. * This sample shows influence of ChecksumValidation on recognition quality and results
  3215. * \code
  3216. * generator = BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128")
  3217. * generator.save("test.png", BarCodeImageFormat.PNG)
  3218. * reader = Recognition.BarCodeReader("test.png", None, DecodeType.EAN_13)
  3219. * #checksum disabled
  3220. * reader.setChecksumValidation(ChecksumValidation.OFF)
  3221. * for result in reader.readBarCodes():
  3222. * print("BarCode CodeText: " + result.getCodeText())
  3223. * print("BarCode Value: " + result.getExtended().getOneD().getValue())
  3224. * print("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum())
  3225. *
  3226. * \endcode
  3227. * \code
  3228. * reader = Recognition.BarCodeReader("test.png", None, DecodeType.EAN_13)
  3229. * #checksum enabled
  3230. * reader.setChecksumValidation(ChecksumValidation.ON)
  3231. * for result in reader.readBarCodes():
  3232. * print("BarCode CodeText: " + result.getCodeText())
  3233. * print("BarCode Value: " + result.getExtended().getOneD().getValue())
  3234. * print("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum())
  3235. * \endcode
  3236. *
  3237. */
  3238. ChecksumValidation =
  3239. {
  3240. /**
  3241. * If checksum is required by the specification - it will be validated.
  3242. */
  3243. DEFAULT: 0,
  3244. /**
  3245. * Always validate checksum if possible.
  3246. */
  3247. ON: 1,
  3248. /**
  3249. * Do not validate checksum
  3250. */
  3251. OFF: 2
  3252. }
  3253. /**
  3254. * <p>
  3255. * <p>
  3256. * Deconvolution (image restorations) mode which defines level of image degradation. Originally deconvolution is a function which can restore image degraded
  3257. * (convoluted) by any natural function like blur, during obtaining image by camera. Because we cannot detect image function which corrupt the image,
  3258. * we have to check most well know functions like sharp or mathematical morphology.
  3259. * </p>
  3260. * </p><p><hr><blockquote><pre>
  3261. * This sample shows how to use Deconvolution mode
  3262. * <pre>
  3263. * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_FULL_ASCII, DecodeType.CODE_128]);
  3264. * reader.getQualitySettings().setDeconvolution(DeconvolutionMode.SLOW);
  3265. * reader.readBarCodes().forEach(function(result, i, results)
  3266. * {
  3267. * console.log("BarCode CodeText: " + result.getCodeText());
  3268. * });
  3269. * </pre>
  3270. * </pre></blockquote></hr></p>
  3271. */
  3272. DeconvolutionMode =
  3273. {
  3274. /**
  3275. * <p>Enables fast deconvolution methods for high quality images.</p>
  3276. */
  3277. FAST: 0,
  3278. /**
  3279. * <p>Enables normal deconvolution methods for common images.</p>
  3280. */
  3281. NORMAL: 1,
  3282. /**
  3283. * <p>Enables slow deconvolution methods for low quality images.</p>
  3284. */
  3285. SLOW: 2
  3286. };
  3287. /**
  3288. * <p>
  3289. * <p>
  3290. * Mode which enables or disables additional recognition of barcodes on images with inverted colors (luminance).
  3291. * </p>
  3292. * </p><p><hr><blockquote><pre>
  3293. * This sample shows how to use InverseImage mode
  3294. * <pre>
  3295. *
  3296. * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_FULL_ASCII, DecodeType.CODE_128]);
  3297. * reader.getQualitySettings().setInverseImage(InverseImageMode.ENABLED);
  3298. * reader.readBarCodes().forEach(function(result, i, results)
  3299. * {
  3300. * console.log("BarCode CodeText: " + result.getCodeText());
  3301. * });
  3302. * </pre>
  3303. * </pre></blockquote></hr></p>
  3304. */
  3305. InverseImageMode =
  3306. {
  3307. /**
  3308. * <p>At this time the same as Disabled. Disables additional recognition of barcodes on inverse images.</p>
  3309. */
  3310. AUTO: 0,
  3311. /**
  3312. * <p>Disables additional recognition of barcodes on inverse images.</p>
  3313. */
  3314. DISABLED: 1,
  3315. /**
  3316. * <p>Enables additional recognition of barcodes on inverse images</p>
  3317. */
  3318. ENABLED: 2
  3319. };
  3320. /**
  3321. * <p>
  3322. * <p>
  3323. * Recognition mode which sets size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
  3324. * </p>
  3325. * </p><p><hr><blockquote><pre>
  3326. * This sample shows how to use XDimension mode
  3327. * <pre>
  3328. * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_FULL_ASCII, DecodeType.CODE_128]);
  3329. * reader.getQualitySettings().setXDimension(XDimensionMode.SMALL);
  3330. * reader.readBarCodes().forEach(function(result, i, results)
  3331. * {
  3332. * console.log("BarCode CodeText: " + result.getCodeText());
  3333. * });
  3334. * </pre>
  3335. * </pre></blockquote></hr></p>
  3336. */
  3337. XDimensionMode =
  3338. {
  3339. /**
  3340. * <p>Value of XDimension is detected by AI (SVM). At this time the same as Normal</p>
  3341. */
  3342. AUTO: 0,
  3343. /**
  3344. * <p>Detects barcodes with small XDimension in 1 pixel or more with quality from BarcodeQuality</p>
  3345. */
  3346. SMALL: 1,
  3347. /**
  3348. * <p>Detects barcodes with classic XDimension in 2 pixels or more with quality from BarcodeQuality or high quality barcodes.</p>
  3349. */
  3350. NORMAL: 2,
  3351. /**
  3352. * <p>Detects barcodes with large XDimension with quality from BarcodeQuality captured with high-resolution cameras.</p>
  3353. */
  3354. LARGE: 3,
  3355. /**
  3356. * <p>Detects barcodes from size set in MinimalXDimension with quality from BarcodeQuality</p>
  3357. */
  3358. USE_MINIMAL_X_DIMENSION: 4
  3359. }
  3360. /**
  3361. * <p>
  3362. * <p>
  3363. * Mode which enables or disables additional recognition of color barcodes on color images.
  3364. * </p>
  3365. * </p><p><hr><blockquote><pre>
  3366. * This sample shows how to use ComplexBackground mode
  3367. * <pre>
  3368. * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_FULL_ASCII, DecodeType.CODE_128]);
  3369. * reader.getQualitySettings().setComplexBackground(ComplexBackgroundMode.ENABLED);
  3370. * reader.readBarCodes().forEach(function(result, i, results)
  3371. * {
  3372. * console.log("BarCode CodeText: " + result.getCodeText());
  3373. * });
  3374. * </pre>
  3375. * </pre></blockquote></hr></p>
  3376. */
  3377. ComplexBackgroundMode =
  3378. {
  3379. /**
  3380. * <p>At this time the same as Disabled. Disables additional recognition of color barcodes on color images.</p>
  3381. */
  3382. AUTO: 0,
  3383. /**
  3384. * <p>Disables additional recognition of color barcodes on color images.</p>
  3385. */
  3386. DISABLED: 1,
  3387. /**
  3388. * <p>Enables additional recognition of color barcodes on color images.</p>
  3389. */
  3390. ENABLED: 2
  3391. }
  3392. /**
  3393. * <p>
  3394. * <p>
  3395. * Mode which enables methods to recognize barcode elements with the selected quality. Barcode element with lower quality requires more hard methods which slows the recognition.
  3396. * </p>
  3397. * </p><p><hr><blockquote><pre>
  3398. * This sample shows how to use BarcodeQuality mode
  3399. * <pre>
  3400. * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_FULL_ASCII, DecodeType.CODE_128]);
  3401. * reader.getQualitySettings().setBarcodeQuality(BarcodeQualityMode.LOW);
  3402. * reader.readBarCodes().forEach(function(result, i, results)
  3403. * {
  3404. * console.log("BarCode CodeText: " + result.getCodeText());
  3405. * });
  3406. * </pre>
  3407. * </pre></blockquote></hr></p>
  3408. */
  3409. BarcodeQualityMode =
  3410. {
  3411. /**
  3412. * <p>Enables recognition methods for High quality barcodes.</p>
  3413. */
  3414. HIGH: 0,
  3415. /**
  3416. * <p>Enables recognition methods for Common(Normal) quality barcodes.</p>
  3417. */
  3418. NORMAL: 1,
  3419. /**
  3420. * <p>Enables recognition methods for Low quality barcodes.</p>
  3421. */
  3422. LOW: 2
  3423. }
  3424. module.exports = {
  3425. BarCodeReader,
  3426. Quadrangle,
  3427. QRExtendedParameters,
  3428. Pdf417ExtendedParameters,
  3429. OneDExtendedParameters,
  3430. Code128ExtendedParameters,
  3431. DecodeType,
  3432. ChecksumValidation,
  3433. BarCodeResult,
  3434. BarCodeRegionParameters,
  3435. BarCodeExtendedParameters,
  3436. QualitySettings,
  3437. BarCodeConfidence,
  3438. Code128SubType,
  3439. Code128DataPortion,
  3440. DataBarExtendedParameters,
  3441. AustraliaPostSettings,
  3442. BarcodeSettings,
  3443. CustomerInformationInterpretingType,
  3444. RecognitionAbortedException,
  3445. DotCodeExtendedParameters,
  3446. DataMatrixExtendedParameters,
  3447. GS1CompositeBarExtendedParameters,
  3448. DeconvolutionMode,
  3449. InverseImageMode,
  3450. XDimensionMode,
  3451. ComplexBackgroundMode,
  3452. BarcodeQualityMode
  3453. };