Skip to content

Commit 0ad2765

Browse files
feat: release v2.1.0 (#25)
1 parent e6368bb commit 0ad2765

24 files changed

+1374
-2566
lines changed

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ The simplest way to include the SDK is to use either the [**jsDelivr**](https://
3131
- jsDelivr
3232

3333
```html
34-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-mrz-scanner@2.0.0/dist/mrz-scanner.bundle.js"></script>
34+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-mrz-scanner@2.1.0/dist/mrz-scanner.bundle.js"></script>
3535
```
3636

3737
- UNPKG
3838

3939
```html
40-
<script src="https://unpkg.com/dynamsoft-mrz-scanner@2.0.0/dist/mrz-scanner.bundle.js"></script>
40+
<script src="https://unpkg.com/dynamsoft-mrz-scanner@2.1.0/dist/mrz-scanner.bundle.js"></script>
4141
```
4242

4343
When using a framework such as **React**, **Vue** or **Angular**, we recommend adding the package as a dependency using a package manager such as **npm** or **yarn**:
4444

4545
```sh
46-
npm i dynamsoft-mrz-scanner@2.0.0 -E
46+
npm i dynamsoft-mrz-scanner@2.1.0 -E
4747
# or
48-
yarn add dynamsoft-mrz-scanner@2.0.0 -E
48+
yarn add dynamsoft-mrz-scanner@2.1.0 -E
4949
```
5050

5151
> [!WARNING]
@@ -60,7 +60,7 @@ Below is the complete Hello World sample page that uses the precompiled script s
6060
<meta charset="utf-8" />
6161
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6262
<title>Dynamsoft MRZ Scanner - Hello World</title>
63-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-mrz-scanner@2.0.0/dist/mrz-scanner.bundle.js"></script>
63+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-mrz-scanner@2.1.0/dist/mrz-scanner.bundle.js"></script>
6464
</head>
6565

6666
<body>
@@ -139,7 +139,7 @@ Let's now go through the code of the Hello World sample and understand the purpo
139139
<meta charset="utf-8" />
140140
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
141141
<title>Dynamsoft MRZ Scanner - Hello World</title>
142-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-mrz-scanner@2.0.0/dist/mrz-scanner.bundle.js"></script>
142+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-mrz-scanner@2.1.0/dist/mrz-scanner.bundle.js"></script>
143143
</head>
144144
145145
<body>
@@ -212,6 +212,13 @@ Here is a quick breakdown of the UI elements that make up the result view
212212

213213
4. **Done Button**: Clicking this button basically closes the scanner and destroys the **MRZScanner** instance. At that point, the application will go back to the landing page, but the developer can dictate the action to take once this button is clicked. These actions can include allowing the user to perform some extra actions with the MRZ result, or navigating to another page, or really anything that the developer would like to do once the scanning operation is done.
214214

215-
>Note:
216-
>
217-
> In the Hello World sample, no action is taken once the Done button is clicked. The scanner closes and the user is met with an empty page. In order to open the scanner again, the user must refresh the page. However, this action can be changed according to the developer's wishes as indicated above.
215+
> [!NOTE]
216+
> In the Hello World sample, no action is taken once the Done button is clicked. The scanner closes and the user is met with an empty page. In order to open the scanner again, the user must refresh the page. You may choose to implement a more user-friendly behavior in a production environment, such as presenting the user with an option to re-open the MRZ Scanner upon closing it.
217+
218+
219+
## Next Steps
220+
221+
Now that you got the most basic functionality of the MRZ Scanner up and running, it's time to explore the many ways in which the MRZ Scanner can be used, including customization and the ability to read directly from static images and PDFs. To learn more about those two topics, please visit the following articles
222+
223+
- [Customizing the MRZ Scanner](https://www.dynamsoft.com/mrz-scanner/docs/web/guides/mrz-scanner-customization.html)
224+
- [Setting up the MRZ Scanner for Static Images and PDFs](https://www.dynamsoft.com/mrz-scanner/docs/web/guides/mrz-scanner-static-image.html)

dev-server/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ app.get("/hello-world", (req, res) => {
5050
res.sendFile(path.join(__dirname, "../samples/hello-world.html"));
5151
});
5252

53+
app.get("/scenarios/use-file-input", (req, res) => {
54+
res.sendFile(path.join(__dirname, "../samples/scenarios/use-file-input.html"));
55+
});
56+
5357
let httpPort = 3002;
5458
let httpsPort = 3003;
5559

@@ -113,6 +117,8 @@ httpServer.listen(httpPort, () => {
113117
console.log("\x1b[90m-------------------\x1b[0m");
114118
console.log("\x1b[33m Hello World:\x1b[0m http://localhost:" + httpPort + "/hello-world");
115119
console.log("\x1b[33m Demo:\x1b[0m http://localhost:" + httpPort + "/demo");
120+
console.log("\x1b[90m-------------------\x1b[0m");
121+
console.log("\x1b[33m Use File Input:\x1b[0m http://localhost:" + httpPort + "/scenarios/use-file-input");
116122
});
117123

118124
httpsServer.listen(httpsPort, "0.0.0.0", () => {
@@ -132,6 +138,8 @@ httpsServer.listen(httpsPort, "0.0.0.0", () => {
132138
ipv4Addresses.forEach((localIP) => {
133139
console.log("\x1b[32m Hello World:\x1b[0m https://" + localIP + ":" + httpsPort + "/hello-world");
134140
console.log("\x1b[32m Demo:\x1b[0m https://" + localIP + ":" + httpsPort + "/demo");
141+
console.log("\x1b[90m-------------------\x1b[0m");
142+
console.log("\x1b[32m Use File Input:\x1b[0m https://" + localIP + ":" + httpsPort + "/scenarios/use-file-input");
135143
});
136144
console.log("\n");
137145
console.log("\x1b[90mPress Ctrl+C to stop the server\x1b[0m\n");

dist/mrz-scanner.bundle.esm.d.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,17 @@ declare enum EnumMRZData {
6767
Age = "age",
6868
Sex = "sex",
6969
IssuingState = "issuingState",
70+
IssuingStateRaw = "issuingStateRaw",
7071
Nationality = "nationality",
72+
NationalityRaw = "nationalityRaw",
7173
DateOfBirth = "dateOfBirth",
7274
DateOfExpiry = "dateOfExpiry"
7375
}
7476
interface MRZResult {
7577
status: ResultStatus;
7678
originalImageResult?: DSImageData;
7779
data?: MRZData;
80+
imageData?: boolean;
7881
_imageData?: DSImageData;
7982
}
8083
interface MRZData {
@@ -87,7 +90,9 @@ interface MRZData {
8790
[EnumMRZData.Age]: number;
8891
[EnumMRZData.Sex]: string;
8992
[EnumMRZData.IssuingState]: string;
93+
[EnumMRZData.IssuingStateRaw]: string;
9094
[EnumMRZData.Nationality]: string;
95+
[EnumMRZData.NationalityRaw]: string;
9196
[EnumMRZData.DateOfBirth]: MRZDate;
9297
[EnumMRZData.DateOfExpiry]: MRZDate;
9398
}
@@ -109,7 +114,10 @@ interface MRZScannerViewConfig {
109114
showUploadImage?: boolean;
110115
showFormatSelector?: boolean;
111116
showSoundToggle?: boolean;
117+
showPoweredByDynamsoft?: boolean;
112118
enableMultiFrameCrossFilter?: boolean;
119+
uploadAcceptedTypes?: string;
120+
uploadFileConverter?: (file: File) => Promise<Blob>;
113121
}
114122
declare class MRZScannerView {
115123
private resources;
@@ -137,7 +145,8 @@ declare class MRZScannerView {
137145
private attachOptionClickListeners;
138146
private highlightCameraAndResolutionOption;
139147
private toggleSelectCameraBox;
140-
private uploadImage;
148+
private relaunch;
149+
private uploadFile;
141150
private toggleSoundFeedback;
142151
private calculateScanRegion;
143152
private toggleScanGuide;
@@ -229,7 +238,13 @@ declare class MRZScanner {
229238
private initializeMRZScannerConfig;
230239
private createViewContainers;
231240
dispose(): void;
232-
launch(): Promise<MRZResult>;
241+
/**
242+
* Processes an uploaded image file
243+
* @param imageOrFile The file to process
244+
* @returns Promise with the document result
245+
*/
246+
private processUploadedFile;
247+
launch(imageOrFile: Blob | string | DSImageData | HTMLImageElement | HTMLVideoElement | HTMLCanvasElement): Promise<MRZResult>;
233248
}
234249

235250
declare const DynamsoftMRZScanner: {

dist/mrz-scanner.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mrz-scanner.bundle.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/mrz-scanner.d.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,17 @@ declare enum EnumMRZData {
7474
Age = "age",
7575
Sex = "sex",
7676
IssuingState = "issuingState",
77+
IssuingStateRaw = "issuingStateRaw",
7778
Nationality = "nationality",
79+
NationalityRaw = "nationalityRaw",
7880
DateOfBirth = "dateOfBirth",
7981
DateOfExpiry = "dateOfExpiry"
8082
}
8183
interface MRZResult {
8284
status: ResultStatus;
8385
originalImageResult?: DSImageData;
8486
data?: MRZData;
87+
imageData?: boolean;
8588
_imageData?: DSImageData;
8689
}
8790
interface MRZData {
@@ -94,7 +97,9 @@ interface MRZData {
9497
[EnumMRZData.Age]: number;
9598
[EnumMRZData.Sex]: string;
9699
[EnumMRZData.IssuingState]: string;
100+
[EnumMRZData.IssuingStateRaw]: string;
97101
[EnumMRZData.Nationality]: string;
102+
[EnumMRZData.NationalityRaw]: string;
98103
[EnumMRZData.DateOfBirth]: MRZDate;
99104
[EnumMRZData.DateOfExpiry]: MRZDate;
100105
}
@@ -116,7 +121,10 @@ interface MRZScannerViewConfig {
116121
showUploadImage?: boolean;
117122
showFormatSelector?: boolean;
118123
showSoundToggle?: boolean;
124+
showPoweredByDynamsoft?: boolean;
119125
enableMultiFrameCrossFilter?: boolean;
126+
uploadAcceptedTypes?: string;
127+
uploadFileConverter?: (file: File) => Promise<Blob>;
120128
}
121129
declare class MRZScannerView {
122130
private resources;
@@ -144,7 +152,8 @@ declare class MRZScannerView {
144152
private attachOptionClickListeners;
145153
private highlightCameraAndResolutionOption;
146154
private toggleSelectCameraBox;
147-
private uploadImage;
155+
private relaunch;
156+
private uploadFile;
148157
private toggleSoundFeedback;
149158
private calculateScanRegion;
150159
private toggleScanGuide;
@@ -236,7 +245,13 @@ declare class MRZScanner {
236245
private initializeMRZScannerConfig;
237246
private createViewContainers;
238247
dispose(): void;
239-
launch(): Promise<MRZResult>;
248+
/**
249+
* Processes an uploaded image file
250+
* @param imageOrFile The file to process
251+
* @returns Promise with the document result
252+
*/
253+
private processUploadedFile;
254+
launch(imageOrFile: Blob | string | DSImageData | HTMLImageElement | HTMLVideoElement | HTMLCanvasElement): Promise<MRZResult>;
240255
}
241256

242257
declare const DynamsoftMRZScanner: {

dist/mrz-scanner.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mrz-scanner.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/mrz-scanner.no-content-bundle.esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)