aspose.barcode 22.9.0 → 22.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/ComplexBarcode.js
CHANGED
|
@@ -65,7 +65,7 @@ class IComplexCodetext extends joint.BaseJavaClass
|
|
|
65
65
|
* swissQRCodetext.getBill().getDebtor().setAddressLine2("Debtor.AddressLine2");
|
|
66
66
|
* swissQRCodetext.getBill().getDebtor().setCountryCode("Lux");
|
|
67
67
|
* let cg = new ComplexBarcodeGenerator(swissQRCodetext);
|
|
68
|
-
* let res = cg.generateBarCodeImage();
|
|
68
|
+
* let res = cg.generateBarCodeImage(BarcodeImageFormat.PNG);
|
|
69
69
|
*/
|
|
70
70
|
class ComplexBarcodeGenerator extends joint.BaseJavaClass {
|
|
71
71
|
static javaClassName = "com.aspose.mw.barcode.complexbarcode.MwComplexBarcodeGenerator";
|
|
@@ -489,7 +489,7 @@ class AlternativeScheme extends joint.BaseJavaClass {
|
|
|
489
489
|
* @example
|
|
490
490
|
* This sample shows how to recognize and decode SwissQR image.
|
|
491
491
|
*
|
|
492
|
-
* let cr = new BarCodeReader("SwissQRCodetext.png", DecodeType.QR);
|
|
492
|
+
* let cr = new BarCodeReader("SwissQRCodetext.png", null, DecodeType.QR);
|
|
493
493
|
* cr.read();
|
|
494
494
|
* let result = ComplexCodetextReader.tryDecodeSwissQR(cr.getCodeText(false));
|
|
495
495
|
*/
|
|
@@ -536,6 +536,33 @@ class ComplexCodetextReader {
|
|
|
536
536
|
}
|
|
537
537
|
return res;
|
|
538
538
|
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Decodes MaxiCode codetext.
|
|
542
|
+
* @param maxiCodeMode MaxiCode mode
|
|
543
|
+
* @param encodedCodetext encoded codetext
|
|
544
|
+
* @return Decoded MaxiCode codetext.
|
|
545
|
+
*/
|
|
546
|
+
static tryDecodeMaxiCode(maxiCodeMode, encodedCodetext)
|
|
547
|
+
{
|
|
548
|
+
let javaComplexCodetextReaderClass = java.import(ComplexCodetextReader.javaClassName);
|
|
549
|
+
let javaMaxiCodeCodetextMode2Class = java.import(MaxiCodeCodetextMode2.JAVA_CLASS_NAME);
|
|
550
|
+
let javaMaxiCodeCodetextMode3Class = java.import(MaxiCodeCodetextMode3.JAVA_CLASS_NAME);
|
|
551
|
+
let javaMaxiCodeCodetext = javaComplexCodetextReaderClass.tryDecodeMaxiCodeSync(maxiCodeMode, encodedCodetext);
|
|
552
|
+
|
|
553
|
+
if(javaMaxiCodeCodetext instanceof javaMaxiCodeCodetextMode2Class)
|
|
554
|
+
{
|
|
555
|
+
return MaxiCodeCodetextMode2.construct(javaMaxiCodeCodetext);
|
|
556
|
+
}
|
|
557
|
+
else if(javaMaxiCodeCodetext instanceof javaMaxiCodeCodetextMode3Class)
|
|
558
|
+
{
|
|
559
|
+
return MaxiCodeCodetextMode3.construct(javaMaxiCodeCodetext);
|
|
560
|
+
}
|
|
561
|
+
else
|
|
562
|
+
{
|
|
563
|
+
return MaxiCodeStandardCodetext.construct(javaMaxiCodeCodetext);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
539
566
|
}
|
|
540
567
|
|
|
541
568
|
/**
|
|
@@ -1416,6 +1443,736 @@ class Mailmark2DCodetext extends IComplexCodetext
|
|
|
1416
1443
|
}
|
|
1417
1444
|
}
|
|
1418
1445
|
|
|
1446
|
+
/**
|
|
1447
|
+
* Base class for encoding and decoding the text embedded in the MaxiCode code.
|
|
1448
|
+
*
|
|
1449
|
+
* This sample shows how to decode raw MaxiCode codetext to MaxiCodeCodetext instance.
|
|
1450
|
+
*
|
|
1451
|
+
* <pre>
|
|
1452
|
+
* let reader = new BarCodeReader("c:\\test.png", null, DecodeType.MAXI_CODE);
|
|
1453
|
+
* reader.readBarCodes().forEach(function(result, i, results)
|
|
1454
|
+
* {
|
|
1455
|
+
* let resultMaxiCodeCodetext = ComplexCodetextReader.tryDecodeMaxiCode(result.getExtended().getMaxiCode().getMaxiCodeMode(), result.getCodeText());
|
|
1456
|
+
* console.log("BarCode Type: " + resultMaxiCodeCodetext.getBarcodeType());
|
|
1457
|
+
* console.log("MaxiCode mode: " + resultMaxiCodeCodetext.getMode());
|
|
1458
|
+
* console.log("BarCode CodeText: " + resultMaxiCodeCodetext.getConstructedCodetext());
|
|
1459
|
+
* });
|
|
1460
|
+
* </pre>
|
|
1461
|
+
*/
|
|
1462
|
+
class MaxiCodeCodetext extends IComplexCodetext
|
|
1463
|
+
{
|
|
1464
|
+
/**
|
|
1465
|
+
* Gets MaxiCode mode.
|
|
1466
|
+
* @return MaxiCode mode
|
|
1467
|
+
*/
|
|
1468
|
+
getMode()
|
|
1469
|
+
{
|
|
1470
|
+
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* Gets a MaxiCode encode mode.
|
|
1475
|
+
*/
|
|
1476
|
+
getMaxiCodeEncodeMode()
|
|
1477
|
+
{
|
|
1478
|
+
return this.getJavaClass().getMaxiCodeEncodeModeSync();
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
/**
|
|
1482
|
+
* Sets a MaxiCode encode mode.
|
|
1483
|
+
*/
|
|
1484
|
+
setMaxiCodeEncodeMode(value)
|
|
1485
|
+
{
|
|
1486
|
+
this.getJavaClass().setMaxiCodeEncodeModeSync(value);
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* Gets ECI encoding. Used when MaxiCodeEncodeMode is AUTO.
|
|
1493
|
+
*/
|
|
1494
|
+
getECIEncoding()
|
|
1495
|
+
{
|
|
1496
|
+
return this.getJavaClass().getECIEncodingSync();
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
/**
|
|
1500
|
+
* Sets ECI encoding. Used when MaxiCodeEncodeMode is AUTO.
|
|
1501
|
+
*/
|
|
1502
|
+
setECIEncoding(value)
|
|
1503
|
+
{
|
|
1504
|
+
this.getJavaClass().setECIEncodingSync(value);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
/**
|
|
1508
|
+
* Gets barcode type.
|
|
1509
|
+
* @return Barcode type
|
|
1510
|
+
*/
|
|
1511
|
+
getBarcodeType()
|
|
1512
|
+
{
|
|
1513
|
+
return this.getJavaClass().getBarcodeTypeSync();
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* Class for encoding and decoding MaxiCode codetext for modes 4, 5 and 6.
|
|
1519
|
+
* @example
|
|
1520
|
+
* //Mode 4
|
|
1521
|
+
* let maxiCodeCodetext = new MaxiCodeStandardCodetext();
|
|
1522
|
+
* maxiCodeCodetext.setMode(MaxiCodeMode.MODE_4);
|
|
1523
|
+
* maxiCodeCodetext.setMessage("Test message");
|
|
1524
|
+
* let complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext.getConstructedCodetext());
|
|
1525
|
+
* complexGenerator.generateBarCodeImage(BarcodeImageFormat.PNG);
|
|
1526
|
+
*
|
|
1527
|
+
* //Mode 5
|
|
1528
|
+
* let maxiCodeCodetext = new MaxiCodeStandardCodetext();
|
|
1529
|
+
* maxiCodeCodetext.setMode(MaxiCodeMode.MODE_5);
|
|
1530
|
+
* maxiCodeCodetext.setMessage("Test message");
|
|
1531
|
+
* let complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext.getConstructedCodetext());
|
|
1532
|
+
* complexGenerator.generateBarCodeImage(BarcodeImageFormat.PNG);
|
|
1533
|
+
*
|
|
1534
|
+
* //Mode 6
|
|
1535
|
+
* let maxiCodeCodetext = new MaxiCodeStandardCodetext();
|
|
1536
|
+
* maxiCodeCodetext.setMode(MaxiCodeMode.MODE_6);
|
|
1537
|
+
* maxiCodeCodetext.setMessage("Test message");
|
|
1538
|
+
* let complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext.getConstructedCodetext());
|
|
1539
|
+
* complexGenerator.generateBarCodeImage(BarcodeImageFormat.PNG);
|
|
1540
|
+
*/
|
|
1541
|
+
class MaxiCodeSecondMessage extends joint.BaseJavaClass
|
|
1542
|
+
{
|
|
1543
|
+
getMessage()
|
|
1544
|
+
{}
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
class MaxiCodeStandardCodetext extends MaxiCodeCodetext
|
|
1548
|
+
{
|
|
1549
|
+
static JAVA_CLASS_NAME = "com.aspose.mw.barcode.complexbarcode.MwMaxiCodeStandardCodetext";
|
|
1550
|
+
|
|
1551
|
+
constructor()
|
|
1552
|
+
{
|
|
1553
|
+
try
|
|
1554
|
+
{
|
|
1555
|
+
let java_class = java.import(MaxiCodeStandardCodetext.JAVA_CLASS_NAME);
|
|
1556
|
+
super(new java_class());
|
|
1557
|
+
}
|
|
1558
|
+
catch (ex)
|
|
1559
|
+
{
|
|
1560
|
+
throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
static construct(javaClass)
|
|
1565
|
+
{
|
|
1566
|
+
let _class = new MaxiCodeStandardCodetext();
|
|
1567
|
+
_class.setJavaClass(javaClass);
|
|
1568
|
+
|
|
1569
|
+
return _class;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* Gets message.
|
|
1574
|
+
*/
|
|
1575
|
+
getMessage()
|
|
1576
|
+
{
|
|
1577
|
+
return this.getJavaClass().getMessageSync();
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* Sets message.
|
|
1582
|
+
*/
|
|
1583
|
+
setMessage(value)
|
|
1584
|
+
{
|
|
1585
|
+
this.getJavaClass().setMessageSync(value);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
/**
|
|
1589
|
+
* Sets MaxiCode mode. Standart codetext can be used only with modes 4, 5 and 6.
|
|
1590
|
+
*/
|
|
1591
|
+
setMode(mode)
|
|
1592
|
+
{
|
|
1593
|
+
this.getJavaClass().setModeSync(mode);
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
/**
|
|
1597
|
+
* Gets MaxiCode mode.
|
|
1598
|
+
* @return MaxiCode mode
|
|
1599
|
+
*/
|
|
1600
|
+
getMode()
|
|
1601
|
+
{
|
|
1602
|
+
return this.getJavaClass().getModeSync();
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
/**
|
|
1606
|
+
* Constructs codetext
|
|
1607
|
+
* @return Constructed codetext
|
|
1608
|
+
*/
|
|
1609
|
+
getConstructedCodetext()
|
|
1610
|
+
{
|
|
1611
|
+
return this.getJavaClass().getConstructedCodetextSync();
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Initializes instance from constructed codetext.
|
|
1616
|
+
* @param constructedCodetext Constructed codetext.
|
|
1617
|
+
*/
|
|
1618
|
+
initFromString(constructedCodetext)
|
|
1619
|
+
{
|
|
1620
|
+
this.getJavaClass().initFromStringSync(constructedCodetext);
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* Returns a value indicating whether this instance is equal to a specified <see cref="MaxiCodeStandardCodetext"/> value.
|
|
1625
|
+
* @param obj An <see cref="MaxiCodeStandardCodetext"/> value to compare to this instance.
|
|
1626
|
+
* @return if obj has the same value as this instance; otherwise, <b>false</b>.
|
|
1627
|
+
*/
|
|
1628
|
+
equals(obj)
|
|
1629
|
+
{
|
|
1630
|
+
return this.getJavaClass().equalsSync(obj.getJavaClass());
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Returns the hash code for this instance.
|
|
1635
|
+
* @return A 32-bit signed integer hash code
|
|
1636
|
+
*/
|
|
1637
|
+
getHashCode()
|
|
1638
|
+
{
|
|
1639
|
+
return this.getJavaClass().getHashCodeSync();
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
init()
|
|
1643
|
+
{
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* Class for encoding and decoding standart second message for MaxiCode barcode.
|
|
1649
|
+
*/
|
|
1650
|
+
class MaxiCodeStandartSecondMessage extends MaxiCodeSecondMessage
|
|
1651
|
+
{
|
|
1652
|
+
static JAVA_CLASS_NAME = "com.aspose.mw.barcode.complexbarcode.MwMaxiCodeStandartSecondMessage";
|
|
1653
|
+
|
|
1654
|
+
constructor()
|
|
1655
|
+
{
|
|
1656
|
+
try
|
|
1657
|
+
{
|
|
1658
|
+
let java_class = new java(MaxiCodeStandartSecondMessage.JAVA_CLASS_NAME);
|
|
1659
|
+
super(java_class);
|
|
1660
|
+
}
|
|
1661
|
+
catch (ex)
|
|
1662
|
+
{
|
|
1663
|
+
throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
/**
|
|
1668
|
+
* Sets second message
|
|
1669
|
+
*/
|
|
1670
|
+
setMessage(value)
|
|
1671
|
+
{
|
|
1672
|
+
this.getJavaClass().setMessageSync(value);
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* Gets second message
|
|
1677
|
+
*/
|
|
1678
|
+
getMessage()
|
|
1679
|
+
{
|
|
1680
|
+
return this.getJavaClass().getMessageSync();
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* Returns a value indicating whether this instance is equal to a specified <see cref="MaxiCodeStandartSecondMessage"/> value.
|
|
1685
|
+
* @param obj An <see cref="MaxiCodeStandartSecondMessage"/> value to compare to this instance
|
|
1686
|
+
* @return <b>true</b> if obj has the same value as this instance; otherwise, <b>false</b>.
|
|
1687
|
+
*/
|
|
1688
|
+
equals(obj)
|
|
1689
|
+
{
|
|
1690
|
+
return this.getJavaClass().equalsSync(obj.getJavaClass());
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Returns the hash code for this instance.
|
|
1695
|
+
* @return A 32-bit signed integer hash code.
|
|
1696
|
+
*/
|
|
1697
|
+
getHashCode()
|
|
1698
|
+
{
|
|
1699
|
+
return this.getJavaClass().getHashCodeSync();
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
init()
|
|
1703
|
+
{
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
/**
|
|
1708
|
+
* Base class for encoding and decoding the text embedded in the MaxiCode code for modes 2 and 3.
|
|
1709
|
+
*
|
|
1710
|
+
* This sample shows how to decode raw MaxiCode codetext to MaxiCodeStructuredCodetext instance.
|
|
1711
|
+
* @example
|
|
1712
|
+
* let reader = new BarCodeReader("c:\\test.png", null, DecodeType.MAXI_CODE);
|
|
1713
|
+
* reader.readBarCodes().forEach(function(result, i, results)
|
|
1714
|
+
* {
|
|
1715
|
+
* let resultMaxiCodeCodetext = ComplexCodetextReader.tryDecodeMaxiCode(result.getExtended().getMaxiCode().getMaxiCodeMode(), result.getCodeText());
|
|
1716
|
+
* if (resultMaxiCodeCodetext instanceof MaxiCodeStructuredCodetext)
|
|
1717
|
+
* {
|
|
1718
|
+
* let maxiCodeStructuredCodetext = resultMaxiCodeCodetext;
|
|
1719
|
+
* console.log("BarCode Type: " + maxiCodeStructuredCodetext.getPostalCode());
|
|
1720
|
+
* console.log("MaxiCode mode: " + maxiCodeStructuredCodetext.getCountryCode());
|
|
1721
|
+
* console.log("BarCode CodeText: " + maxiCodeStructuredCodetext.getServiceCategory());
|
|
1722
|
+
* }
|
|
1723
|
+
* });
|
|
1724
|
+
*/
|
|
1725
|
+
class MaxiCodeStructuredCodetext extends MaxiCodeCodetext
|
|
1726
|
+
{
|
|
1727
|
+
static JAVA_CLASS_NAME = "com.aspose.mw.barcode.complexbarcode.MwMaxiCodeStructuredCodetext";
|
|
1728
|
+
|
|
1729
|
+
maxiCodeSecondMessage;
|
|
1730
|
+
|
|
1731
|
+
constructor(javaClass)
|
|
1732
|
+
{
|
|
1733
|
+
try
|
|
1734
|
+
{
|
|
1735
|
+
super(javaClass);
|
|
1736
|
+
}
|
|
1737
|
+
catch (ex)
|
|
1738
|
+
{
|
|
1739
|
+
throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
init()
|
|
1744
|
+
{
|
|
1745
|
+
let javaMaxiCodeSecondMessage = this.getJavaClass().getSecondMessage();
|
|
1746
|
+
let javaMaxiCodeStandartSecondMessageClass = java.import("com.aspose.mw.barcode.complexbarcode.MwMaxiCodeStandartSecondMessage");
|
|
1747
|
+
let javaMaxiCodeStandartSecondMessage = new javaMaxiCodeStandartSecondMessageClass();
|
|
1748
|
+
let javaMaxiCodeStructuredSecondMessageClass = java.import("com.aspose.mw.barcode.complexbarcode.MwMaxiCodeStructuredSecondMessage");
|
|
1749
|
+
let javaMaxiCodeStructuredSecondMessage = new javaMaxiCodeStructuredSecondMessageClass();
|
|
1750
|
+
|
|
1751
|
+
if(javaMaxiCodeSecondMessage instanceof javaMaxiCodeStandartSecondMessage)
|
|
1752
|
+
{
|
|
1753
|
+
this.maxiCodeSecondMessage = new MaxiCodeStandartSecondMessage(this.getJavaClass().getSecondMessageSync());
|
|
1754
|
+
}
|
|
1755
|
+
else if(javaMaxiCodeSecondMessage instanceof javaMaxiCodeStructuredSecondMessage)
|
|
1756
|
+
{
|
|
1757
|
+
this.maxiCodeSecondMessage = new MaxiCodeStructuredSecondMessage(this.getJavaClass().getSecondMessageSync());
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* Identifies the postal code. Must be 9 digits in mode 2 or
|
|
1763
|
+
* 6 alphanumeric symbols in mode 3.
|
|
1764
|
+
*/
|
|
1765
|
+
getPostalCode()
|
|
1766
|
+
{
|
|
1767
|
+
return this.getJavaClass().getPostalCodeSync();
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
/**
|
|
1771
|
+
* Identifies 3 digit country code.
|
|
1772
|
+
*/
|
|
1773
|
+
getCountryCode()
|
|
1774
|
+
{
|
|
1775
|
+
return this.getJavaClass().getCountryCodeSync();
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
/**
|
|
1779
|
+
* Identifies 3 digit country code.
|
|
1780
|
+
*/
|
|
1781
|
+
setCountryCode(value)
|
|
1782
|
+
{
|
|
1783
|
+
this.getJavaClass().setCountryCodeSync(value);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* Identifies 3 digit service category.
|
|
1788
|
+
*/
|
|
1789
|
+
getServiceCategory()
|
|
1790
|
+
{
|
|
1791
|
+
return this.getJavaClass().getServiceCategorySync();
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
/**
|
|
1795
|
+
* Identifies 3 digit service category.
|
|
1796
|
+
*/
|
|
1797
|
+
setServiceCategory(value)
|
|
1798
|
+
{
|
|
1799
|
+
this.getJavaClass().setServiceCategorySync(value);
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
/**
|
|
1803
|
+
* Identifies second message of the barcode.
|
|
1804
|
+
*/
|
|
1805
|
+
getSecondMessage()
|
|
1806
|
+
{
|
|
1807
|
+
return this.maxiCodeSecondMessage;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
/**
|
|
1811
|
+
* Identifies second message of the barcode.
|
|
1812
|
+
*/
|
|
1813
|
+
setSecondMessage(value)
|
|
1814
|
+
{
|
|
1815
|
+
this.maxiCodeSecondMessage = value;
|
|
1816
|
+
this.getJavaClass().setSecondMessageSync(value.getJavaClass());
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
/**
|
|
1820
|
+
* Constructs codetext
|
|
1821
|
+
* @return Constructed codetext
|
|
1822
|
+
*/
|
|
1823
|
+
getConstructedCodetext()
|
|
1824
|
+
{
|
|
1825
|
+
return this.getJavaClass().getConstructedCodetextSync();
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* Initializes instance from constructed codetext.
|
|
1830
|
+
* @param constructedCodetext Constructed codetext.
|
|
1831
|
+
*/
|
|
1832
|
+
initFromString(constructedCodetext)
|
|
1833
|
+
{
|
|
1834
|
+
this.getJavaClass().initFromStringSync(constructedCodetext);
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
/**
|
|
1838
|
+
* Returns a value indicating whether this instance is equal to a specified <see cref="MaxiCodeStructuredCodetext"/> value.
|
|
1839
|
+
* @param obj An <see cref="MaxiCodeStructuredCodetext"/> value to compare to this instance
|
|
1840
|
+
* @return <b>true</b> if obj has the same value as this instance; otherwise, <b>false</b>
|
|
1841
|
+
*/
|
|
1842
|
+
equals(obj)
|
|
1843
|
+
{
|
|
1844
|
+
return this.getJavaClass().equalsSync(obj.getJavaClass());
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* Returns the hash code for this instance.
|
|
1849
|
+
* @return A 32-bit signed integer hash code.
|
|
1850
|
+
*/
|
|
1851
|
+
getHashCode()
|
|
1852
|
+
{
|
|
1853
|
+
return this.getJavaClass().getHashCodeSync();
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
/**
|
|
1858
|
+
* Class for encoding and decoding the text embedded in the MaxiCode code for modes 2.
|
|
1859
|
+
*
|
|
1860
|
+
* This sample shows how to encode and decode MaxiCode codetext for mode 2.
|
|
1861
|
+
* @example
|
|
1862
|
+
* //Mode 2 with standart second message
|
|
1863
|
+
* let maxiCodeCodetext = new MaxiCodeCodetextMode2();
|
|
1864
|
+
* maxiCodeCodetext.setPostalCode("524032140");
|
|
1865
|
+
* maxiCodeCodetext.setCountryCode(056);
|
|
1866
|
+
* maxiCodeCodetext.setServiceCategory(999);
|
|
1867
|
+
* let maxiCodeStandartSecondMessage = new MaxiCodeStandartSecondMessage();
|
|
1868
|
+
* maxiCodeStandartSecondMessage.setMessage("Test message");
|
|
1869
|
+
* maxiCodeCodetext.setSecondMessage(maxiCodeStandartSecondMessage);
|
|
1870
|
+
* let complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext);
|
|
1871
|
+
* complexGenerator.generateBarCodeImage(BarcodeImageFormat.PNG);
|
|
1872
|
+
*
|
|
1873
|
+
* //Mode 2 with structured second message
|
|
1874
|
+
* let maxiCodeCodetext = new MaxiCodeCodetextMode2();
|
|
1875
|
+
* maxiCodeCodetext.setPostalCode("524032140");
|
|
1876
|
+
* maxiCodeCodetext.setCountryCode(056);
|
|
1877
|
+
* maxiCodeCodetext.setServiceCategory(999);
|
|
1878
|
+
* let maxiCodeStructuredSecondMessage = new MaxiCodeStructuredSecondMessage();
|
|
1879
|
+
* maxiCodeStructuredSecondMessage.add("634 ALPHA DRIVE");
|
|
1880
|
+
* maxiCodeStructuredSecondMessage.add("PITTSBURGH");
|
|
1881
|
+
* maxiCodeStructuredSecondMessage.add("PA");
|
|
1882
|
+
* maxiCodeStructuredSecondMessage.setYear(99);
|
|
1883
|
+
* maxiCodeCodetext.setSecondMessage(maxiCodeStructuredSecondMessage);
|
|
1884
|
+
* let complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext);
|
|
1885
|
+
* complexGenerator.generateBarCodeImage(BarcodeImageFormat.PNG);
|
|
1886
|
+
*
|
|
1887
|
+
* //Decoding raw codetext with standart second message
|
|
1888
|
+
* let reader = new BarCodeReader("c:\\test.png", null, DecodeType.MAXI_CODE);
|
|
1889
|
+
* {
|
|
1890
|
+
* reader.readBarCodes().forEach(function(result, i, results)
|
|
1891
|
+
* {
|
|
1892
|
+
* let resultMaxiCodeCodetext = ComplexCodetextReader.tryDecodeMaxiCode(result.getExtended().getMaxiCode().getMaxiCodeMode(), result.getCodeText());
|
|
1893
|
+
* if (resultMaxiCodeCodetext instanceof MaxiCodeCodetextMode2)
|
|
1894
|
+
* {
|
|
1895
|
+
* let maxiCodeStructuredCodetext = resultMaxiCodeCodetext;
|
|
1896
|
+
* console.log("BarCode Type: " + maxiCodeStructuredCodetext.getPostalCode());
|
|
1897
|
+
* console.log("MaxiCode mode: " + maxiCodeStructuredCodetext.getCountryCode());
|
|
1898
|
+
* console.log("BarCode CodeText: " + maxiCodeStructuredCodetext.getServiceCategory());
|
|
1899
|
+
* if (maxiCodeStructuredCodetext.getSecondMessage() instanceof MaxiCodeStandartSecondMessage){
|
|
1900
|
+
* let secondMessage = maxiCodeStructuredCodetext.getSecondMessage();
|
|
1901
|
+
* console.log("Message: " + secondMessage.getMessage());
|
|
1902
|
+
* }
|
|
1903
|
+
* }
|
|
1904
|
+
* });
|
|
1905
|
+
* }
|
|
1906
|
+
* //Decoding raw codetext with structured second message
|
|
1907
|
+
* let reader = new BarCodeReader("c:\\test.png", null, DecodeType.MAXI_CODE);
|
|
1908
|
+
* {
|
|
1909
|
+
* reader.readBarCodes().forEach(function(result, i, results)
|
|
1910
|
+
* {
|
|
1911
|
+
* let resultMaxiCodeCodetext = ComplexCodetextReader.tryDecodeMaxiCode(result.getExtended().getMaxiCode().getMaxiCodeMode(), result.getCodeText());
|
|
1912
|
+
* if (resultMaxiCodeCodetext instanceof MaxiCodeCodetextMode2){
|
|
1913
|
+
* let maxiCodeStructuredCodetext = resultMaxiCodeCodetext;
|
|
1914
|
+
* console.log("BarCode Type: " + maxiCodeStructuredCodetext.getPostalCode());
|
|
1915
|
+
* console.log("MaxiCode mode: " + maxiCodeStructuredCodetext.getCountryCode());
|
|
1916
|
+
* console.log("BarCode CodeText: " + maxiCodeStructuredCodetext.getServiceCategory());
|
|
1917
|
+
* if (maxiCodeStructuredCodetext.getSecondMessage() instanceof MaxiCodeStructuredSecondMessage){
|
|
1918
|
+
* let secondMessage = maxiCodeStructuredCodetext.getSecondMessage();
|
|
1919
|
+
* console.log("Message:");
|
|
1920
|
+
* secondMessage.getIdentifiers().forEach(identifier,i, identifiers){
|
|
1921
|
+
* console.log(identifier);
|
|
1922
|
+
* });
|
|
1923
|
+
* }
|
|
1924
|
+
* }
|
|
1925
|
+
* });
|
|
1926
|
+
* }
|
|
1927
|
+
*/
|
|
1928
|
+
class MaxiCodeCodetextMode2 extends MaxiCodeStructuredCodetext
|
|
1929
|
+
{
|
|
1930
|
+
static JAVA_CLASS_NAME = "com.aspose.mw.barcode.complexbarcode.MwMaxiCodeCodetextMode2";
|
|
1931
|
+
|
|
1932
|
+
constructor()
|
|
1933
|
+
{
|
|
1934
|
+
try
|
|
1935
|
+
{
|
|
1936
|
+
let java_class = new java(MaxiCodeCodetextMode2.JAVA_CLASS_NAME);
|
|
1937
|
+
super(java_class);
|
|
1938
|
+
}
|
|
1939
|
+
catch (ex)
|
|
1940
|
+
{
|
|
1941
|
+
throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
static construct(javaClass)
|
|
1946
|
+
{
|
|
1947
|
+
let _class = new MaxiCodeCodetextMode2();
|
|
1948
|
+
_class.setJavaClass(javaClass);
|
|
1949
|
+
|
|
1950
|
+
return _class;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* Gets MaxiCode mode.
|
|
1955
|
+
* @return MaxiCode mode
|
|
1956
|
+
*/
|
|
1957
|
+
getMode()
|
|
1958
|
+
{
|
|
1959
|
+
return this.getJavaClass().getModeSync();
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
init()
|
|
1963
|
+
{
|
|
1964
|
+
super.init();
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
/**
|
|
1969
|
+
* Class for encoding and decoding the text embedded in the MaxiCode code for modes 3.
|
|
1970
|
+
* This sample shows how to encode and decode MaxiCode codetext for mode 3.
|
|
1971
|
+
* @example
|
|
1972
|
+
* //Mode 3 with standart second message
|
|
1973
|
+
* let maxiCodeCodetext = new MaxiCodeCodetextMode3();
|
|
1974
|
+
* maxiCodeCodetext.setPostalCode("B1050");
|
|
1975
|
+
* maxiCodeCodetext.setCountryCode(056);
|
|
1976
|
+
* maxiCodeCodetext.setServiceCategory(999);
|
|
1977
|
+
* let maxiCodeStandartSecondMessage = new MaxiCodeStandartSecondMessage();
|
|
1978
|
+
* maxiCodeStandartSecondMessage.setMessage("Test message");
|
|
1979
|
+
* maxiCodeCodetext.setSecondMessage(maxiCodeStandartSecondMessage);
|
|
1980
|
+
* let complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext);
|
|
1981
|
+
* complexGenerator.generateBarCodeImage(BarcodeImageFormat.PNG);
|
|
1982
|
+
*
|
|
1983
|
+
* //Mode 3 with structured second message
|
|
1984
|
+
* let maxiCodeCodetext = new MaxiCodeCodetextMode3();
|
|
1985
|
+
* maxiCodeCodetext.setPostalCode("B1050");
|
|
1986
|
+
* maxiCodeCodetext.setCountryCode(056);
|
|
1987
|
+
* maxiCodeCodetext.setServiceCategory(999);
|
|
1988
|
+
* let maxiCodeStructuredSecondMessage = new MaxiCodeStructuredSecondMessage();
|
|
1989
|
+
* maxiCodeStructuredSecondMessage.add("634 ALPHA DRIVE");
|
|
1990
|
+
* maxiCodeStructuredSecondMessage.add("PITTSBURGH");
|
|
1991
|
+
* maxiCodeStructuredSecondMessage.add("PA");
|
|
1992
|
+
* maxiCodeStructuredSecondMessage.setYear(99);
|
|
1993
|
+
* maxiCodeCodetext.setSecondMessage(maxiCodeStructuredSecondMessage);
|
|
1994
|
+
* let complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext);
|
|
1995
|
+
* complexGenerator.generateBarCodeImage(BarcodeImageFormat.PNG);
|
|
1996
|
+
*
|
|
1997
|
+
* //Decoding raw codetext with standart second message
|
|
1998
|
+
* let reader = new BarCodeReader("c:\\test.png", null, DecodeType.MAXI_CODE);
|
|
1999
|
+
* reader.readBarCodes().forEach(function(result, i, results)
|
|
2000
|
+
* {
|
|
2001
|
+
* let resultMaxiCodeCodetext = ComplexCodetextReader.tryDecodeMaxiCode(result.getExtended().getMaxiCode().getMaxiCodeMode(), result.getCodeText());
|
|
2002
|
+
* if (resultMaxiCodeCodetext instanceOf MaxiCodeCodetextMode3)
|
|
2003
|
+
* {
|
|
2004
|
+
* let maxiCodeStructuredCodetext = resultMaxiCodeCodetext;
|
|
2005
|
+
* console.log("BarCode Type: " + maxiCodeStructuredCodetext.getPostalCode());
|
|
2006
|
+
* console.log("MaxiCode mode: " + maxiCodeStructuredCodetext.getCountryCode());
|
|
2007
|
+
* console.log("BarCode CodeText: " + maxiCodeStructuredCodetext.getServiceCategory());
|
|
2008
|
+
* if (maxiCodeStructuredCodetext.getSecondMessage() instanceOf MaxiCodeStandartSecondMessage)
|
|
2009
|
+
* {
|
|
2010
|
+
* let secondMessage = maxiCodeStructuredCodetext.getSecondMessage();
|
|
2011
|
+
* console.log("Message: " + secondMessage.getMessage());
|
|
2012
|
+
* }
|
|
2013
|
+
* }
|
|
2014
|
+
* });
|
|
2015
|
+
* //Decoding raw codetext with structured second message
|
|
2016
|
+
* let reader = new BarCodeReader("c:\\test.png", null, DecodeType.MAXI_CODE);
|
|
2017
|
+
* reader.readBarCodes().forEach(function(result, i, results)
|
|
2018
|
+
* {
|
|
2019
|
+
* let resultMaxiCodeCodetext = ComplexCodetextReader.tryDecodeMaxiCode(result.getExtended().getMaxiCode().getMaxiCodeMode(), result.getCodeText());
|
|
2020
|
+
* if (resultMaxiCodeCodetext instanceOf MaxiCodeCodetextMode3)
|
|
2021
|
+
* {
|
|
2022
|
+
* let maxiCodeStructuredCodetext = resultMaxiCodeCodetext;
|
|
2023
|
+
* console.log("BarCode Type: " + maxiCodeStructuredCodetext.getPostalCode());
|
|
2024
|
+
* console.log("MaxiCode mode: " + maxiCodeStructuredCodetext.getCountryCode());
|
|
2025
|
+
* console.log("BarCode CodeText: " + maxiCodeStructuredCodetext.getServiceCategory());
|
|
2026
|
+
* if (maxiCodeStructuredCodetext.getSecondMessage() instanceOf MaxiCodeStructuredSecondMessage)
|
|
2027
|
+
* {
|
|
2028
|
+
* let secondMessage = maxiCodeStructuredCodetext.getSecondMessage();
|
|
2029
|
+
* console.log("Message:");
|
|
2030
|
+
* secondMessage.getIdentifiers().forEach(identifier,i, identifiers){
|
|
2031
|
+
* console.log(identifier);
|
|
2032
|
+
* });
|
|
2033
|
+
* }
|
|
2034
|
+
* }
|
|
2035
|
+
* });
|
|
2036
|
+
*/
|
|
2037
|
+
class MaxiCodeCodetextMode3 extends MaxiCodeStructuredCodetext
|
|
2038
|
+
{
|
|
2039
|
+
static JAVA_CLASS_NAME = "com.aspose.mw.barcode.complexbarcode.MwMaxiCodeCodetextMode3";
|
|
2040
|
+
|
|
2041
|
+
constructor()
|
|
2042
|
+
{
|
|
2043
|
+
try
|
|
2044
|
+
{
|
|
2045
|
+
let java_class = new java(MaxiCodeCodetextMode3.JAVA_CLASS_NAME);
|
|
2046
|
+
super(java_class);
|
|
2047
|
+
}
|
|
2048
|
+
catch (ex)
|
|
2049
|
+
{
|
|
2050
|
+
throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
static construct(javaClass)
|
|
2055
|
+
{
|
|
2056
|
+
let _class = new MaxiCodeCodetextMode3();
|
|
2057
|
+
_class.setJavaClass(javaClass);
|
|
2058
|
+
|
|
2059
|
+
return _class;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
/**
|
|
2063
|
+
* Gets MaxiCode mode.
|
|
2064
|
+
* @return MaxiCode mode
|
|
2065
|
+
*/
|
|
2066
|
+
getMode()
|
|
2067
|
+
{
|
|
2068
|
+
return this.getJavaClass().getMode();
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
init()
|
|
2072
|
+
{
|
|
2073
|
+
super.init();
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
/**
|
|
2078
|
+
* Class for encoding and decoding structured second message for MaxiCode barcode.
|
|
2079
|
+
*/
|
|
2080
|
+
class MaxiCodeStructuredSecondMessage extends MaxiCodeSecondMessage
|
|
2081
|
+
{
|
|
2082
|
+
static JAVA_CLASS_NAME = "com.aspose.mw.barcode.complexbarcode.MwMaxiCodeStructuredSecondMessage";
|
|
2083
|
+
|
|
2084
|
+
constructor()
|
|
2085
|
+
{
|
|
2086
|
+
try
|
|
2087
|
+
{
|
|
2088
|
+
let java_class = java.import(MaxiCodeStructuredSecondMessage.JAVA_CLASS_NAME);
|
|
2089
|
+
super(new java_class());
|
|
2090
|
+
}
|
|
2091
|
+
catch (ex)
|
|
2092
|
+
{
|
|
2093
|
+
throw new BarcodeException(ex.getMessage(), __FILE__, __LINE__);
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
/**
|
|
2098
|
+
* Gets year. Year must be 2 digit integer value.
|
|
2099
|
+
*/
|
|
2100
|
+
getYear()
|
|
2101
|
+
{
|
|
2102
|
+
return this.getJavaClass().getYear();
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
/**
|
|
2106
|
+
* Sets year. Year must be 2 digit integer value.
|
|
2107
|
+
*/
|
|
2108
|
+
setYear(value)
|
|
2109
|
+
{
|
|
2110
|
+
this.getJavaClass().setYear(value);
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
/**
|
|
2114
|
+
* Gets identifiers list
|
|
2115
|
+
* @return List of identifiers
|
|
2116
|
+
*/
|
|
2117
|
+
getIdentifiers()
|
|
2118
|
+
{
|
|
2119
|
+
let identifiers_string = this.getJavaClass().getIdentifiersSync();
|
|
2120
|
+
let delimeter = "\\/\\";
|
|
2121
|
+
let identifiers = identifiers_string.split(delimeter);
|
|
2122
|
+
|
|
2123
|
+
return identifiers;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
/**
|
|
2127
|
+
* Adds new identifier
|
|
2128
|
+
* @param identifier Identifier to be added
|
|
2129
|
+
*/
|
|
2130
|
+
add(identifier)
|
|
2131
|
+
{
|
|
2132
|
+
this.getJavaClass().addSync(identifier);
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
/**
|
|
2136
|
+
* Clear identifiers list
|
|
2137
|
+
*/
|
|
2138
|
+
clear()
|
|
2139
|
+
{
|
|
2140
|
+
this.getJavaClass().clearSync();
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
/**
|
|
2144
|
+
* Gets constructed second message
|
|
2145
|
+
* @return Constructed second message
|
|
2146
|
+
*/
|
|
2147
|
+
getMessage()
|
|
2148
|
+
{
|
|
2149
|
+
return this.getJavaClass().getMessageSync();
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
/**
|
|
2153
|
+
* Returns a value indicating whether this instance is equal to a specified <see cref="MaxiCodeStructuredSecondMessage"/> value.
|
|
2154
|
+
* @param obj "obj">An <see cref="MaxiCodeStructuredSecondMessage"/> value to compare to this instance.
|
|
2155
|
+
* @return <b>true</b> if obj has the same value as this instance; otherwise, <b>false</b>.
|
|
2156
|
+
*/
|
|
2157
|
+
equals(obj)
|
|
2158
|
+
{
|
|
2159
|
+
return this.getJavaClass().equalsSync(obj.getJavaClass());
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
/**
|
|
2163
|
+
* Returns the hash code for this instance.
|
|
2164
|
+
* @return A 32-bit signed integer hash code.
|
|
2165
|
+
*/
|
|
2166
|
+
getHashCode()
|
|
2167
|
+
{
|
|
2168
|
+
return this.getJavaClass().getHashCodeSync();
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
init()
|
|
2172
|
+
{
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
|
|
1419
2176
|
/**
|
|
1420
2177
|
* 2D Mailmark Type defines size of Data Matrix barcode
|
|
1421
2178
|
* @enum
|
|
@@ -1454,5 +2211,11 @@ module.exports = {
|
|
|
1454
2211
|
Mailmark2DCodetext,
|
|
1455
2212
|
MailmarkCodetext,
|
|
1456
2213
|
Mailmark2DType,
|
|
1457
|
-
QrBillStandardVersion
|
|
2214
|
+
QrBillStandardVersion,
|
|
2215
|
+
MaxiCodeStandardCodetext,
|
|
2216
|
+
MaxiCodeSecondMessage,
|
|
2217
|
+
MaxiCodeStructuredSecondMessage,
|
|
2218
|
+
MaxiCodeCodetextMode3,
|
|
2219
|
+
MaxiCodeCodetextMode2,
|
|
2220
|
+
MaxiCodeCodetext
|
|
1458
2221
|
};
|