diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..0f9429a
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "liveServer.settings.port": 5503
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 244cff1..c437e7c 100644
--- a/README.md
+++ b/README.md
@@ -1,24 +1,22 @@
# About the solution
-Passport MRZ Scanner enables camera to scan the MRZ code of a passport. It will extract all data like firstname, lastname, passport number, nationality, date of birth, expiration date and personal number from the MRZ string, and converts the encoded string into human-readable fields. Welcome to visit dynamsoft's [official website](https://dynamsoft.com/capture-vision/docs/web/programming/javascript/user-guide/passport-mrz-scanner.html) to learn more about this solution.
+The MRZ Scanner enables camera to scan the MRZ code of ID-cards and passports. It will extract all data like first name, last name, document number, nationality, date of birth, expiration date and more from the MRZ string, and converts the encoded string into human-readable fields.
## Web demo
-The web demo is available at [https://demo.dynamsoft.com/solutions/passport-scanner/index.html](https://demo.dynamsoft.com/solutions/passport-scanner/index.html) (nothing will be uploaded).
+The web demo is available at [https://demo.dynamsoft.com/solutions/mrz-scanner/index.html](https://demo.dynamsoft.com/solutions/mrz-scanner/index.html) (nothing will be uploaded).
## Run this Solution
-1. Clone the repo to a working directory
+1. Clone the repository to a working directory or download the code as a ZIP file:
```sh
-git clone https://github.com/Dynamsoft/passport-MRZ-scanner-javascript
+git clone https://github.com/Dynamsoft/MRZ-scanner-javascript
```
-2. CD to the folder and run an https server
+2. Deploy the files to a directory hosted on an HTTPS server.
-```sh
-cd passport-MRZ-scanner-javascript
-```
+3. Open the "index.html" file in your browser.
> Basic Requirements
>
@@ -30,12 +28,12 @@ cd passport-MRZ-scanner-javascript
## Request a Trial License
-The key "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" used in this solution serves as a test license valid for 24 hours, applicable to any newly authorized browser. To test the SDK further, you can request a 30-day free trial license via the Request a Trial License link.
+The key "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" used in this solution (found in the js/init.js file) is a test license valid for 24 hours for any newly authorized browser. If you wish to test the SDK further, you can request a 30-day free trial license through the Request a Trial License link.
## Project Structure
```text
-Passport MRZ Scanner
+MRZ Scanner
├── assets
│ ├── ...
│ ├── ...
@@ -47,7 +45,7 @@ Passport MRZ Scanner
│ ├── ...
│ └── ...
├── js
-│ ├── define.js
+│ ├── const.js
│ ├── index.js
│ ├── init.js
│ └── util.js
@@ -59,7 +57,7 @@ Passport MRZ Scanner
* `/css` : This directory contains the CSS file(s) used for styling the project.
* `/font` : This directory contains the font files used in the project.
* `/js` : This directory contains all the JavaScript files used in the project.
- * `define.js` : This file contains definitions of certain constants or variables used across the project.
+ * `const.js` : This file contains definitions of certain constants or variables used across the project.
* `index.js`: This is the main JavaScript file where the core logic of the project is implemented.
* `init.js` : This file is used for initialization purposes, such as initializing license, load resources, etc.
* `util.js` : This file contains utility functions that are used across the project.
diff --git a/assets/Music-selected.svg b/assets/Music-selected.svg
index ff3d7a2..f440979 100644
--- a/assets/Music-selected.svg
+++ b/assets/Music-selected.svg
@@ -1,14 +1,6 @@
-
+
\ No newline at end of file
diff --git a/assets/passport frame.svg b/assets/mrz-guide-box.svg
similarity index 99%
rename from assets/passport frame.svg
rename to assets/mrz-guide-box.svg
index caa616c..c5702ef 100644
--- a/assets/passport frame.svg
+++ b/assets/mrz-guide-box.svg
@@ -7,7 +7,7 @@
.st1{enable-background:new ;}
.st2{fill:#AAAAAA;}
-
+
@@ -133,4 +133,4 @@
-
+
\ No newline at end of file
diff --git a/assets/music-unselected.svg b/assets/music-unselected.svg
index 4b5f4be..0edab1f 100644
--- a/assets/music-unselected.svg
+++ b/assets/music-unselected.svg
@@ -1,10 +1,7 @@
-
+
\ No newline at end of file
diff --git a/assets/torch-icon-close.svg b/assets/torch-icon-close.svg
new file mode 100644
index 0000000..6b47cce
--- /dev/null
+++ b/assets/torch-icon-close.svg
@@ -0,0 +1,14 @@
+
\ No newline at end of file
diff --git a/assets/torch-icon-open.svg b/assets/torch-icon-open.svg
new file mode 100644
index 0000000..e8c0013
--- /dev/null
+++ b/assets/torch-icon-open.svg
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/css/index.css b/css/index.css
index 77bbbe9..72356f9 100644
--- a/css/index.css
+++ b/css/index.css
@@ -25,6 +25,18 @@ body {
height: 100%;
-webkit-text-size-adjust: 100%;
/* Prevent font scaling in landscape while allowing user zoom */
+ background-color: #2b2b2b;
+}
+
+button {
+ border: none;
+ cursor: pointer;
+ color: #ffffff;
+ border: 0;
+}
+
+img {
+ user-select: none;
}
.home-page {
@@ -39,8 +51,9 @@ body {
justify-content: space-between;
align-items: center;
color: #ffffff;
- background-color: #323234;
+ background-color: #2b2b2b;
padding: 30px 0;
+ gap: 20px;
}
.home-page .logo {
@@ -49,8 +62,12 @@ body {
}
.home-page .description {
- width: 80%;
+ width: 50%;
text-align: center;
+ background-color: #323234;
+ margin: 0 auto;
+ padding: 2rem;
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.home-page .description .title {
@@ -62,7 +79,7 @@ body {
font-family: OpenSans-Regular;
font-size: 16px;
line-height: 26px;
- margin: 16px 0 25px 0;
+ margin: 16px 0 25px;
}
.home-page .description .start-btn {
@@ -70,16 +87,21 @@ body {
height: 6vh;
min-height: 40px;
max-height: 60px;
- background-color: #FE8E14;
+ background-color: #fe8e14;
font-family: Oswald-Regular;
font-size: 20px;
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
-.home-page .power {
+.home-page .description .start-btn:hover {
+ background-color: #fea543;
+}
+
+.home-page .powered-by-msg {
font-size: 16px;
font-family: Oswald-Light;
}
@@ -97,6 +119,8 @@ body {
background-color: rgb(55, 55, 55);
display: flex;
align-items: center;
+ gap: 15px;
+ position: relative;
}
.scanner-container .header .camera-selector {
@@ -107,7 +131,11 @@ body {
justify-content: space-around;
align-items: center;
padding: 0 10px;
- margin-right: 15px;
+ cursor: pointer;
+}
+
+.scanner-container .header .camera-selector:hover {
+ opacity: 0.8;
}
.scanner-container .header .camera-selector .camera-svg {
@@ -120,27 +148,32 @@ body {
}
.scanner-container .header .camera-list {
- width: 165px;
position: absolute;
top: 46px;
left: 0;
background-color: #000000;
- z-index: 1;
+ z-index: 3;
display: none;
+ border-right: #aaaaaa;
}
.scanner-container .header .camera-list .camera-item {
width: 100%;
height: 40px;
- color: #AAAAAA;
+ color: #aaaaaa;
border-bottom: 1px solid rgb(50, 50, 52);
font-size: 12px;
- font-family: "OpenSans-Regular";
+ font-family: OpenSans-Regular;
line-height: 40px;
padding: 0 10px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
+ user-select: none;
+ cursor: pointer;
+}
+.scanner-container .header .camera-list .camera-item:hover {
+ opacity: 0.8;
}
.scanner-container .header .camera-list .camera-selected {
@@ -151,14 +184,27 @@ body {
border: unset;
}
-.scanner-container .header .music {
+.scanner-container .header .music-container {
width: 30px;
height: 30px;
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+}
+
+.scanner-container .header .music-container:hover {
+ opacity: 0.8;
+}
+
+.scanner-container .header .music {
+ width: 24px;
+ height: 24px;
}
.scanner-container .header .no-music {
- width: 22px;
- height: 22px;
+ width: 24px;
+ height: 24px;
display: none;
}
@@ -181,19 +227,15 @@ body {
height: 6%;
min-height: 35px;
max-height: 50px;
- padding: 0 15px 0 30px;
- background-color: #2B2B2B;
+ background-color: #2b2b2b;
display: flex;
justify-content: space-between;
align-items: center;
+ padding: 0 15px 0 30px;
}
.result-container .result-header .result-title {
- color: #AAAAAA;
-}
-
-.result-container .result-header .result-restart {
- color: #FE8E14;
+ color: #aaaaaa;
}
.result-container .parsed-result-area {
@@ -203,11 +245,6 @@ body {
overflow: auto;
}
-.result-container .parsed-result-area .parsed-result-header {
- font-size: 18px;
- margin-bottom: 30px;
-}
-
.result-container .parsed-result-area .parsed-filed {
display: flex;
flex-direction: column;
@@ -215,7 +252,13 @@ body {
}
.result-container .parsed-result-area .parsed-filed .field-name {
- color: #AAAAAA;
+ color: #aaaaaa;
+}
+.result-container .parsed-result-area .parsed-filed .field-value {
+ word-wrap: break-word;
+}
+.result-container .parsed-result-area .code .field-value {
+ font-family: monospace;
}
.result-container .restart-video {
@@ -223,9 +266,11 @@ body {
height: 10%;
min-height: 60px;
max-height: 100px;
+ background-color: #2b2b2b;
display: flex;
justify-content: center;
align-items: center;
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.result-container .restart-video .btn-restart-video {
@@ -238,6 +283,99 @@ body {
font-family: "Oswald-Regular";
}
+.scan-mode-container {
+ display: none;
+ justify-content: center;
+ align-items: center;
+ position: fixed;
+ bottom: 15%;
+ left: 5%;
+ right: 5%;
+ z-index: 2;
+}
+
+.scan-mode-container .scan-mode-content {
+ position: relative;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background-color: rgb(34, 34, 34);
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
+ border-radius: 8px;
+ padding: 0.5rem;
+ width: max-content;
+ opacity: 0.8;
+}
+
+.scan-option-btn {
+ background-color: transparent;
+ padding: 0.5rem;
+ font-family: OpenSans-Regular;
+ color: white;
+ flex: 1;
+ width: 5rem;
+}
+
+.selected {
+ background-color: #fe8e14;
+ color: white;
+ border-radius: 8px;
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
+}
+
+#notification {
+ text-align: center;
+ text-align: center;
+ padding: 0.5rem;
+ width: -moz-fit-content;
+ width: fit-content;
+ position: absolute;
+ z-index: 3;
+ bottom: -200%;
+ left: 0;
+ right: 0;
+ margin-left: auto;
+ margin-right: auto;
+ font-family: Oswald-Light;
+ color: #fff;
+
+ /* Fade in animation */
+ opacity: 0;
+ display: none;
+ transition: opacity 300ms;
+}
+
+.banner-default {
+ background-color: rgb(254, 142, 20, 0.4);
+ border: 1px solid #fe8e14;
+}
+.banner-error {
+ background-color: rgb(252, 2, 0, 0.4);
+ border: 1px solid #fc0200;
+}
+.banner-success {
+ background-color: rgb(124, 252, 0, 0.4);
+ border: 1px solid #00fc15;
+}
+
+.get-demo-code {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ color: #ffae38;
+ margin-left: auto;
+ margin-right: 1rem;
+ font-family: Oswald-Regular;
+ text-decoration: none;
+}
+
+.dbr-download-code-icon {
+ width: 16px;
+ height: 16px;
+ stroke: #ffae38;
+ margin-left: 5px;
+}
+
@keyframes dce-rotate {
from {
transform: rotate(0turn);
@@ -258,8 +396,25 @@ body {
}
}
-@media screen and (max-width: 780px) and (orientation: landscape) {
+@media screen and (max-width: 800px) {
+ html,
+ body,
+ .home-page {
+ background-color: #323234;
+ }
+
+ .home-page .description {
+ width: 80%;
+ box-shadow: none;
+ }
+
+ .home-page .description .start-btn {
+ font-size: 20px;
+ }
+}
+
+@media screen and (max-width: 800px) and (orientation: landscape) {
.result-container .parsed-result-area .parsed-filed {
font-size: 14px;
}
-}
\ No newline at end of file
+}
diff --git a/index.html b/index.html
index 58596a3..b42e852 100644
--- a/index.html
+++ b/index.html
@@ -1,160 +1,319 @@
-
-
-
-
- Passport MRZ Scanner
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Passport MRZ Scanner
-
Dynamsoft Passport MRZ Scanner recognizes the Machine-Readable Zone (MRZ) on the biographical page of a passport and converts the encoded strings into human-readable fields.
-
Scan a Passport
+
+
+
+ Dynamsoft MRZ Scanner
+
+
+
+
+
+
+
+
+
+
MRZ Scanner
+
+ Dynamsoft MRZ Scanner recognizes the Machine-Readable Zone (MRZ) on a passport or ID card and converts the
+ encoded strings into human-readable fields
+