aspose.barcode 26.4.0 → 26.6.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/AsposeBarcode.js +1 -1
- package/lib/ComplexBarcode.js +206 -1
- package/lib/Generation.js +410 -0
- package/lib/Joint.js +27 -1
- package/lib/Recognition.js +100 -0
- package/lib/{aspose-barcode-nodejs-26.4.jar → aspose-barcode-nodejs-26.6.jar} +0 -0
- package/package.json +1 -1
- package/examples/BarcodeGeneratorExamples.js +0 -231
- package/examples/BarcodeReaderExamples.js +0 -198
- package/examples/ExamplesAssist.js +0 -75
- package/examples/GenerateAndReadExample.js +0 -25
- package/examples/how_to.txt +0 -15
- package/examples/how_to_generate_and_read_example.js.cmd +0 -2
- package/examples/how_to_generate_barcode_examples.js.cmd +0 -2
- package/examples/how_to_read_barcode_examples.js.cmd +0 -2
- package/examples/lic/.stub +0 -1
- package/examples/package.json +0 -13
- package/examples/resources/generating/.stub +0 -1
- package/examples/resources/generating/setBarcodeType.png +0 -0
- package/examples/resources/recognition/code11.png +0 -0
- package/examples/resources/recognition/code128.jpg +0 -0
- package/examples/resources/recognition/example1.png +0 -0
- package/examples/resources/recognition/example2.jpg +0 -0
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
const ea = require("./ExamplesAssist")
|
|
2
|
-
const aspose_barcode = ea.aspose_barcode
|
|
3
|
-
let BarCodeReader = aspose_barcode.BarCodeReader;
|
|
4
|
-
let BarcodeGenerator = aspose_barcode.BarcodeGenerator;
|
|
5
|
-
let EncodeTypes = aspose_barcode.EncodeTypes;
|
|
6
|
-
let QualitySettings = aspose_barcode.QualitySettings;
|
|
7
|
-
|
|
8
|
-
class BarCodeReaderExamples
|
|
9
|
-
{
|
|
10
|
-
subfolder = "resources/recognition/";
|
|
11
|
-
|
|
12
|
-
howToReadFromFile()
|
|
13
|
-
{
|
|
14
|
-
console.log("\n---\nfunction '" + this.howToReadFromFile.name + "'\n");
|
|
15
|
-
let file_name = "code11.png";
|
|
16
|
-
let full_path = this.subfolder + file_name;
|
|
17
|
-
let reader = new BarCodeReader(full_path, null, null);
|
|
18
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
19
|
-
{
|
|
20
|
-
console.log(result.getCodeText());
|
|
21
|
-
|
|
22
|
-
console.log(result.getCodeTypeName());
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
howToReadImageBytes()
|
|
28
|
-
{
|
|
29
|
-
let fileName = "code11.png";
|
|
30
|
-
let reader = new BarCodeReader(ea.loadImageByName(this.subfolder, fileName), null, null);
|
|
31
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
32
|
-
{
|
|
33
|
-
console.log(result.getCodeText());
|
|
34
|
-
|
|
35
|
-
console.log(result.getCodeTypeName());
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
howToSetQualitySettings()
|
|
40
|
-
{
|
|
41
|
-
console.log("\n---\nfunction '" + this.howToSetQualitySettings.name + "'\n");
|
|
42
|
-
let file_name = "code11.png";
|
|
43
|
-
let full_path = this.subfolder + file_name;
|
|
44
|
-
let reader = new BarCodeReader(full_path, null, null);
|
|
45
|
-
reader.setQualitySettings(QualitySettings.getHighPerformance());
|
|
46
|
-
|
|
47
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
48
|
-
{
|
|
49
|
-
console.log(result.getCodeText());
|
|
50
|
-
|
|
51
|
-
console.log(result.getCodeTypeName());
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
howToGetCodeBytes()
|
|
58
|
-
{
|
|
59
|
-
console.log("\n---\nfunction '" + this.howToGetCodeBytes.name + "'\n");
|
|
60
|
-
let expectedCodeBytes = ["105", "99", "70", "1", "61", "0", "0", "2", "70", "10", "82", "20", "40", "0", "97", "106"];
|
|
61
|
-
let fileName = "example2.jpg";
|
|
62
|
-
let reader = new BarCodeReader(ea.loadImageByName(this.subfolder, fileName), null, null);
|
|
63
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
64
|
-
{
|
|
65
|
-
let actualCodeBytes = result.getCodeBytes();
|
|
66
|
-
console.log("expected code bytes : " + expectedCodeBytes.length);
|
|
67
|
-
|
|
68
|
-
console.log("actual code bytes : " + actualCodeBytes.length);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
howToRecognitionCode128()
|
|
73
|
-
{
|
|
74
|
-
console.log("\n---\nfunction '" + this.howToRecognitionCode128.name + "'\n");
|
|
75
|
-
try
|
|
76
|
-
{
|
|
77
|
-
let fileName = "code128.jpg";
|
|
78
|
-
let reader = new BarCodeReader(ea.loadImageByName(this.subfolder, fileName), null, DecodeType.CODE_128);
|
|
79
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
80
|
-
{
|
|
81
|
-
console.log("Code Text : " + result.getCodeTypeName());
|
|
82
|
-
|
|
83
|
-
console.log("Code Type : " + result.getCodeText());
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
} catch (e)
|
|
87
|
-
{
|
|
88
|
-
console.log(e.getMessage());
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
howToRecognitionCode11()
|
|
93
|
-
{
|
|
94
|
-
console.log("\n---\nfunction '" + this.howToRecognitionCode11.name + "'\n");
|
|
95
|
-
try
|
|
96
|
-
{
|
|
97
|
-
let fileName = "code11.png";
|
|
98
|
-
let reader = new BarCodeReader(ea.loadImageByName(this.subfolder, fileName), null, DecodeType.CODE_11);
|
|
99
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
100
|
-
{
|
|
101
|
-
console.log("Code Text : " + result.getCodeTypeName());
|
|
102
|
-
|
|
103
|
-
console.log("Code Type : " + result.getCodeText());
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
} catch (e)
|
|
107
|
-
{
|
|
108
|
-
console.log(e.getMessage());
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
howToRecognitionCodeAllSupportedTypes()
|
|
113
|
-
{
|
|
114
|
-
console.log("\n---\nfunction '" + this.howToRecognitionCodeAllSupportedTypes.name + "'\n");
|
|
115
|
-
try
|
|
116
|
-
{
|
|
117
|
-
let fileName = "example2.jpg";
|
|
118
|
-
let reader = new BarCodeReader(ea.loadImageByName(this.subfolder, fileName), null, DecodeType.ALL_SUPPORTED_TYPES);
|
|
119
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
120
|
-
{
|
|
121
|
-
console.log("Code Text : " + result.getCodeTypeName());
|
|
122
|
-
|
|
123
|
-
console.log("Code Type : " + result.getCodeText());
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
} catch (e)
|
|
127
|
-
{
|
|
128
|
-
console.log(e.getMessage());
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
howToRecognitionCodeAllSupportedTypes2()
|
|
133
|
-
{
|
|
134
|
-
console.log("\n---\nfunction '" + this.howToRecognitionCodeAllSupportedTypes2.name + "'\n");
|
|
135
|
-
try
|
|
136
|
-
{
|
|
137
|
-
let fileName = "example1.png";
|
|
138
|
-
let reader = new BarCodeReader(ea.loadImageByName(this.subfolder, fileName), null, DecodeType.ALL_SUPPORTED_TYPES);
|
|
139
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
140
|
-
{
|
|
141
|
-
console.log("Code Text : " + result.getCodeTypeName());
|
|
142
|
-
console.log("Code Type : " + result.getCodeText());
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
} catch (e)
|
|
146
|
-
{
|
|
147
|
-
console.log(e.getMessage());
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
howToRecognitionSetBarCodeImage()
|
|
152
|
-
{
|
|
153
|
-
console.log("\n---\nfunction '" + this.howToRecognitionSetBarCodeImage.name + "'\n");
|
|
154
|
-
let fileName = "code128.jpg";
|
|
155
|
-
let reader = new BarCodeReader(ea.loadImageByName(this.subfolder, fileName), null, DecodeType.ALL_SUPPORTED_TYPES);
|
|
156
|
-
reader.setBarCodeImage(this.subfolder + "code11.png", null);
|
|
157
|
-
|
|
158
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
159
|
-
{
|
|
160
|
-
console.log("Code Text : " + result.getCodeTypeName());
|
|
161
|
-
|
|
162
|
-
console.log("Code Type : " + result.getCodeText());
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
howToMacroPdf417()
|
|
168
|
-
{
|
|
169
|
-
console.log("\n---\nfunction '" + this.howToMacroPdf417.name + "'\n");
|
|
170
|
-
let barcodeGenerator = new BarcodeGenerator(EncodeTypes.MACRO_PDF_417, null);
|
|
171
|
-
barcodeGenerator.setCodeText("codeSomecode");
|
|
172
|
-
barcodeGenerator.getParameters().getBarcode().getPdf417().setPdf417MacroFileID(15900);
|
|
173
|
-
barcodeGenerator.getParameters().getBarcode().getPdf417().setPdf417MacroSegmentID(2);
|
|
174
|
-
barcodeGenerator.getParameters().getBarcode().getPdf417().setPdf417MacroSegmentsCount(3);
|
|
175
|
-
let image = barcodeGenerator.generateBarCodeImage(aspose_barcode.BarCodeImageFormat.PNG);
|
|
176
|
-
let reader = new BarCodeReader((image), null, DecodeType.MACRO_PDF_417);
|
|
177
|
-
reader.readBarCodes().forEach(function (result, i, results)
|
|
178
|
-
{
|
|
179
|
-
console.log("CodeText : " + result.getCodeText());
|
|
180
|
-
console.log("getMacroPdf417FileID : " + result.getExtended().getPdf417().getMacroPdf417FileID() + "\n");
|
|
181
|
-
console.log("getMacroPdf417SegmentID : " + result.getExtended().getPdf417().getMacroPdf417SegmentID() + "\n");
|
|
182
|
-
console.log('getMacroPdf417SegmentsCount : ' + result.getExtended().getPdf417().getMacroPdf417SegmentsCount() + "\n");
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
ea.setLicense();
|
|
188
|
-
let barCodeReaderExamples = new BarCodeReaderExamples();
|
|
189
|
-
barCodeReaderExamples.howToReadFromFile();
|
|
190
|
-
barCodeReaderExamples.howToReadImageBytes();
|
|
191
|
-
barCodeReaderExamples.howToSetQualitySettings();
|
|
192
|
-
barCodeReaderExamples.howToGetCodeBytes();
|
|
193
|
-
barCodeReaderExamples.howToRecognitionCode128();
|
|
194
|
-
barCodeReaderExamples.howToRecognitionCode11();
|
|
195
|
-
barCodeReaderExamples.howToRecognitionCodeAllSupportedTypes();
|
|
196
|
-
barCodeReaderExamples.howToRecognitionCodeAllSupportedTypes2();
|
|
197
|
-
barCodeReaderExamples.howToRecognitionSetBarCodeImage();
|
|
198
|
-
barCodeReaderExamples.howToMacroPdf417();
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
let libs_root = "../"
|
|
2
|
-
const index_path = libs_root + "index.js";
|
|
3
|
-
const barcode_ = require(index_path)
|
|
4
|
-
const aspose_barcode = barcode_.AsposeBarcode
|
|
5
|
-
//in case you obtained the lib from npmjs.com by calling the command "npm i aspose.barcode"
|
|
6
|
-
// replace all above lines by two lines
|
|
7
|
-
// const barcode_ = require("aspose.barcode");
|
|
8
|
-
// const aspose_barcode = barcode_.AsposeBarcode
|
|
9
|
-
|
|
10
|
-
const path_to_license_file = "./lic/Aspose.BarCode.NodeJsviaJava.lic";
|
|
11
|
-
const fs = require("fs");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function setLicense()
|
|
15
|
-
{
|
|
16
|
-
let license = new aspose_barcode.License();
|
|
17
|
-
if (fs.existsSync(path_to_license_file))
|
|
18
|
-
{
|
|
19
|
-
license.setLicense(path_to_license_file);
|
|
20
|
-
}
|
|
21
|
-
else
|
|
22
|
-
{
|
|
23
|
-
console.log("Path \"" + path_to_license_file + "\" doesn't exist\n");
|
|
24
|
-
}
|
|
25
|
-
let is_licensed = license.isLicensed();
|
|
26
|
-
console.log('is licensed: ' + is_licensed);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function isExists(file_path)
|
|
30
|
-
{
|
|
31
|
-
if (fs.existsSync(file_path))
|
|
32
|
-
{
|
|
33
|
-
console.log(file_path + " exists")
|
|
34
|
-
}
|
|
35
|
-
else
|
|
36
|
-
{
|
|
37
|
-
console.log(file_path + " doesn't exist")
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @param subFolder path to image
|
|
43
|
-
* @param fileName name of image
|
|
44
|
-
* @returns base64 encoded image
|
|
45
|
-
*/
|
|
46
|
-
function loadImageByName(subFolder, fileName)
|
|
47
|
-
{
|
|
48
|
-
let filePath = subFolder + "/" + fileName;
|
|
49
|
-
try
|
|
50
|
-
{
|
|
51
|
-
return fs.readFileSync(filePath).toString('base64');
|
|
52
|
-
} catch (ex)
|
|
53
|
-
{
|
|
54
|
-
console.error(ex.toString());
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function saveImageBase64(image64, path)
|
|
59
|
-
{
|
|
60
|
-
try
|
|
61
|
-
{
|
|
62
|
-
console.log("Will be saved to : " + path);
|
|
63
|
-
let image_bytes = Buffer.from(image64, 'base64');
|
|
64
|
-
fs.writeFileSync(path, image_bytes);
|
|
65
|
-
return fs.existsSync(path);
|
|
66
|
-
} catch (ex)
|
|
67
|
-
{
|
|
68
|
-
let barcode_exception = new barcodetestexception_.BarcodeTestException(ex);
|
|
69
|
-
throw barcode_exception;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
module.exports = {
|
|
74
|
-
aspose_barcode, setLicense, isExists, loadImageByName, saveImageBase64
|
|
75
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const ea = require("./ExamplesAssist")
|
|
3
|
-
const aspose_barcode = ea.aspose_barcode
|
|
4
|
-
let BarcodeGenerator = aspose_barcode.BarcodeGenerator;
|
|
5
|
-
let EncodeTypes = aspose_barcode.EncodeTypes;
|
|
6
|
-
let BarCodeReader = aspose_barcode.BarCodeReader;
|
|
7
|
-
|
|
8
|
-
function generateAndRead()
|
|
9
|
-
{
|
|
10
|
-
ea.setLicense();
|
|
11
|
-
let generator = new BarcodeGenerator(EncodeTypes.CODE_128, "12367891011");
|
|
12
|
-
let file_path = "resources/generating/setBarcodeType.png";
|
|
13
|
-
generator.save(file_path, aspose_barcode.BarCodeImageFormat.PNG);
|
|
14
|
-
|
|
15
|
-
let image_data_base64 = fs.readFileSync(file_path).toString('base64');
|
|
16
|
-
let reader = new BarCodeReader(image_data_base64, null, DecodeType.ALL_SUPPORTED_TYPES);
|
|
17
|
-
|
|
18
|
-
reader.readBarCodes().forEach(function(result, i, results)
|
|
19
|
-
{
|
|
20
|
-
console.log("Recognized barcode code text: " + result.getCodeText() + "\n");
|
|
21
|
-
console.log("Recognized barcode code type: " + result.getCodeTypeName() + "\n");
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
generateAndRead();
|
package/examples/how_to.txt
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
1. If you're launching the tests outside of 'node_modules' folder, replace lines in 'ExamplesAssist.js'
|
|
2
|
-
Instead of first four lines should be added
|
|
3
|
-
const barcode_ = require("aspose.barcode");
|
|
4
|
-
const aspose_barcode = barcode_.AsposeBarcode
|
|
5
|
-
2. Run command 'npm install'
|
|
6
|
-
3. Put the license file 'Aspose.BarCode.NodeJsviaJava.lic' to the folder lic.
|
|
7
|
-
The expected name of the license file is Aspose.BarCode.NodeJsviaJava.lic.
|
|
8
|
-
You can change it by changing line 10 of ExampleAssist.js.
|
|
9
|
-
4. Open and run every file consistently :
|
|
10
|
-
how_to_generate_and_read_example.js
|
|
11
|
-
how_to_generate_barcode_examples.js
|
|
12
|
-
how_to_read_barcode_examples.js
|
|
13
|
-
You can run them from the command line,
|
|
14
|
-
for example 'node how_to_generate_and_read_example.js.cmd'
|
|
15
|
-
|
package/examples/lic/.stub
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Place license to this folder
|
package/examples/package.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "barcode.nodejs.examples",
|
|
3
|
-
"description": "Aspose.Barcode for Node.js via Java examples",
|
|
4
|
-
"main": "index.js",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
-
},
|
|
8
|
-
"author": "",
|
|
9
|
-
"license": "ISC",
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"java": "^0.12.1"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Folder for generated files
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|