aspose.barcode 21.12.5 → 22.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/AsposeBarcode.js
CHANGED
package/lib/Generation.js
CHANGED
|
@@ -45,6 +45,13 @@ class BarcodeGenerator extends joint.BaseJavaClass
|
|
|
45
45
|
this.init();
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
static construct(javaClass)
|
|
49
|
+
{
|
|
50
|
+
let barcodeGenerator = new BarcodeGenerator( null, null);
|
|
51
|
+
barcodeGenerator.setJavaClass(javaClass);
|
|
52
|
+
return barcodeGenerator;
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
init()
|
|
49
56
|
{
|
|
50
57
|
this.parameters = new BaseGenerationParameters(this.getJavaClass().getParametersSync());
|
|
@@ -65,7 +72,7 @@ class BarcodeGenerator extends joint.BaseJavaClass
|
|
|
65
72
|
*/
|
|
66
73
|
getBarcodeType()
|
|
67
74
|
{
|
|
68
|
-
return this.getJavaClass().getBarcodeTypeSync()
|
|
75
|
+
return this.getJavaClass().getBarcodeTypeSync();
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
/**
|
|
@@ -127,6 +134,52 @@ class BarcodeGenerator extends joint.BaseJavaClass
|
|
|
127
134
|
{
|
|
128
135
|
this.getJavaClass().setCodeTextSync(value);
|
|
129
136
|
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Exports BarCode properties to the xml file specified
|
|
140
|
+
* @param filePath The xml file
|
|
141
|
+
* @return Whether or not export completed successfully. Returns <b>True</b> in case of success; <b>False</b> Otherwise </para>
|
|
142
|
+
* @throws IOException
|
|
143
|
+
*/
|
|
144
|
+
exportToXml(filePath)
|
|
145
|
+
{
|
|
146
|
+
try
|
|
147
|
+
{
|
|
148
|
+
let xmlData = this.getJavaClass().exportToXmlSync();
|
|
149
|
+
let isSaved = xmlData != null;
|
|
150
|
+
if (isSaved)
|
|
151
|
+
{
|
|
152
|
+
fs.writeFileSync(filePath, xmlData);
|
|
153
|
+
}
|
|
154
|
+
return isSaved;
|
|
155
|
+
}
|
|
156
|
+
catch (ex)
|
|
157
|
+
{
|
|
158
|
+
throw new BarcodeException(ex.getMessage());
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* <p>
|
|
164
|
+
* Imports BarCode properties from the xml-file specified and creates BarcodeGenerator instance.
|
|
165
|
+
* </p>
|
|
166
|
+
* @return BarcodeGenerator instance
|
|
167
|
+
* @param filePath The name of the file
|
|
168
|
+
*/
|
|
169
|
+
importFromXml(filePath)
|
|
170
|
+
{
|
|
171
|
+
try
|
|
172
|
+
{
|
|
173
|
+
let xmlData = joint.convertResourceToBase64String(filePath);
|
|
174
|
+
let offset = 6;
|
|
175
|
+
xmlData = xmlData.substr(offset);
|
|
176
|
+
return BarcodeGenerator.construct(java(BarcodeGenerator.javaClassName).importFromXmlSync(xmlData));
|
|
177
|
+
}
|
|
178
|
+
catch (ex)
|
|
179
|
+
{
|
|
180
|
+
throw new BarcodeException(ex.getMessage());
|
|
181
|
+
}
|
|
182
|
+
}
|
|
130
183
|
}
|
|
131
184
|
|
|
132
185
|
/**
|
|
@@ -4559,7 +4612,7 @@ EncodeTypes =
|
|
|
4559
4612
|
/**
|
|
4560
4613
|
* Represents Royal Mail Mailmark barcode.
|
|
4561
4614
|
*/
|
|
4562
|
-
MAILMARK:
|
|
4615
|
+
MAILMARK: 66,
|
|
4563
4616
|
|
|
4564
4617
|
/**
|
|
4565
4618
|
* Specifies that the data should be encoded with GS1 Databar omni-directional barcode specification.
|
|
@@ -4923,38 +4976,45 @@ Code128Emulation =
|
|
|
4923
4976
|
BarCodeImageFormat =
|
|
4924
4977
|
{
|
|
4925
4978
|
/**
|
|
4926
|
-
*
|
|
4927
|
-
* Specifies the W3C Portable Network Graphics (PNG) image format.
|
|
4928
|
-
* </p>
|
|
4979
|
+
* Specifies the bitmap (BMP) image format.
|
|
4929
4980
|
*/
|
|
4930
|
-
BMP:
|
|
4981
|
+
BMP:0,
|
|
4982
|
+
|
|
4983
|
+
/**
|
|
4984
|
+
* Specifies the Graphics Interchange Format (GIF) image format.
|
|
4985
|
+
*/
|
|
4986
|
+
GIF:1,
|
|
4931
4987
|
|
|
4932
4988
|
/**
|
|
4933
|
-
* <p>
|
|
4934
4989
|
* Specifies the Joint Photographic Experts Group (JPEG) image format.
|
|
4935
|
-
* </p>
|
|
4936
4990
|
*/
|
|
4937
|
-
|
|
4991
|
+
JPEG:2,
|
|
4938
4992
|
|
|
4939
4993
|
/**
|
|
4940
|
-
*
|
|
4941
|
-
* Specifies the bitmap (BMP) image format.
|
|
4942
|
-
* </p>
|
|
4994
|
+
* Specifies the W3C Portable Network Graphics (PNG) image format.
|
|
4943
4995
|
*/
|
|
4944
|
-
|
|
4996
|
+
PNG:3,
|
|
4945
4997
|
|
|
4946
4998
|
/**
|
|
4947
|
-
*
|
|
4948
|
-
|
|
4949
|
-
|
|
4999
|
+
* Specifies the Tagged Image File Format (TIFF) image format.
|
|
5000
|
+
*/
|
|
5001
|
+
TIFF:4,
|
|
5002
|
+
|
|
5003
|
+
|
|
5004
|
+
/**
|
|
5005
|
+
* Specifies the Tagged Image File Format (TIFF) image format in CMYK color model.
|
|
4950
5006
|
*/
|
|
4951
|
-
|
|
5007
|
+
TIFF_IN_CMYK:5,
|
|
4952
5008
|
|
|
4953
5009
|
/**
|
|
4954
5010
|
* Specifies the Enhanced Metafile (EMF) image format.
|
|
4955
|
-
* (Supported only on Windows platform, on *nix platforms is saved as PNG)
|
|
4956
5011
|
*/
|
|
4957
|
-
EMF:
|
|
5012
|
+
EMF:6,
|
|
5013
|
+
|
|
5014
|
+
/**
|
|
5015
|
+
* Specifies the Scalable Vector Graphics (SVG) image format.
|
|
5016
|
+
*/
|
|
5017
|
+
SVG:7
|
|
4958
5018
|
};
|
|
4959
5019
|
|
|
4960
5020
|
module.exports = {
|
package/lib/Joint.js
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
const java = require('java');
|
|
2
2
|
const fs = require("fs");
|
|
3
3
|
|
|
4
|
+
|
|
5
|
+
function isPath(image)
|
|
6
|
+
{
|
|
7
|
+
if (image.length < 256 && image.includes("/") || image.includes("\\"))
|
|
8
|
+
{
|
|
9
|
+
if (fs.existsSync(image))
|
|
10
|
+
{
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
throw new joint.BarcodeException("Path " + image + " does not exist");
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function convertResourceToBase64String(resource)
|
|
19
|
+
{
|
|
20
|
+
let is_path_to_image = false;
|
|
21
|
+
is_path_to_image = fs.existsSync(resource);
|
|
22
|
+
|
|
23
|
+
if (is_path_to_image)
|
|
24
|
+
{
|
|
25
|
+
return fs.readFileSync(resource).toString('base64');
|
|
26
|
+
}
|
|
27
|
+
else
|
|
28
|
+
{
|
|
29
|
+
return resource;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
4
33
|
class BaseJavaClass
|
|
5
34
|
{
|
|
6
35
|
javaClass;
|
|
@@ -406,5 +435,5 @@ class BuildVersionInfo
|
|
|
406
435
|
}
|
|
407
436
|
|
|
408
437
|
module.exports = {
|
|
409
|
-
BaseJavaClass, BarcodeException, Rectangle, Point, License, BuildVersionInfo
|
|
438
|
+
BaseJavaClass, BarcodeException, Rectangle, Point, License, BuildVersionInfo, isPath, convertResourceToBase64String
|
|
410
439
|
};
|
package/lib/Recognition.js
CHANGED
|
@@ -34,9 +34,9 @@ class BarCodeReader extends joint.BaseJavaClass
|
|
|
34
34
|
{
|
|
35
35
|
if(image != null)
|
|
36
36
|
{
|
|
37
|
-
if (
|
|
37
|
+
if (joint.isPath(image))
|
|
38
38
|
{
|
|
39
|
-
image =
|
|
39
|
+
image = joint.convertResourceToBase64String(image);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
if (rectangles != null)
|
|
@@ -88,19 +88,6 @@ class BarCodeReader extends joint.BaseJavaClass
|
|
|
88
88
|
return barcodeReader;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
static isPath(image)
|
|
92
|
-
{
|
|
93
|
-
if (image.length < 256 && image.includes("/") || image.includes("\\"))
|
|
94
|
-
{
|
|
95
|
-
if (fs.existsSync(image))
|
|
96
|
-
{
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
throw new joint.BarcodeException("Path " + image + " does not exist");
|
|
100
|
-
}
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
91
|
/**
|
|
105
92
|
* Determines whether any of the given decode types is included into<br>
|
|
106
93
|
* @param ...decodeTypes Types to verify.
|
|
@@ -115,21 +102,6 @@ class BarCodeReader extends joint.BaseJavaClass
|
|
|
115
102
|
return this.getJavaClass().containsAnySync(decodeTypes);
|
|
116
103
|
}
|
|
117
104
|
|
|
118
|
-
static loadImage(image)
|
|
119
|
-
{
|
|
120
|
-
let is_path_to_image = false;
|
|
121
|
-
is_path_to_image = fs.existsSync(image);
|
|
122
|
-
|
|
123
|
-
if (is_path_to_image)
|
|
124
|
-
{
|
|
125
|
-
return fs.readFileSync(image).toString('base64');
|
|
126
|
-
}
|
|
127
|
-
else
|
|
128
|
-
{
|
|
129
|
-
return image;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
105
|
static convertToString(arg)
|
|
134
106
|
{
|
|
135
107
|
if (is_int(arg))
|
|
@@ -585,7 +557,7 @@ class BarCodeReader extends joint.BaseJavaClass
|
|
|
585
557
|
*/
|
|
586
558
|
setBarCodeImage(image, ...areas)
|
|
587
559
|
{
|
|
588
|
-
image =
|
|
560
|
+
image = joint.convertResourceToBase64String(image);
|
|
589
561
|
let stringAreas = [];
|
|
590
562
|
let isAllRectanglesNotNull = false;
|
|
591
563
|
if (!(areas == null) && areas.length > 0)
|
|
@@ -644,7 +616,7 @@ class BarCodeReader extends joint.BaseJavaClass
|
|
|
644
616
|
|
|
645
617
|
/**
|
|
646
618
|
* Exports BarCode properties to the xml-file specified
|
|
647
|
-
* @param xmlFile The name
|
|
619
|
+
* @param xmlFile The name of the file
|
|
648
620
|
* @return Whether or not export completed successfully.
|
|
649
621
|
* Returns True in case of success; False Otherwise
|
|
650
622
|
*/
|
|
@@ -667,7 +639,7 @@ class BarCodeReader extends joint.BaseJavaClass
|
|
|
667
639
|
|
|
668
640
|
/**
|
|
669
641
|
* Exports BarCode properties to the xml-file specified
|
|
670
|
-
* @param xmlFile The name
|
|
642
|
+
* @param xmlFile The name of the file
|
|
671
643
|
* @return Whether or not export completed successfully. Returns True in case of success; False Otherwise
|
|
672
644
|
*/
|
|
673
645
|
static importFromXml(xmlFile)
|
|
Binary file
|