{"id":16052205,"url":"https://github.com/dynamsoft/barcode-reader-javascript","last_synced_at":"2025-12-13T08:59:35.322Z","repository":{"id":40471127,"uuid":"145683056","full_name":"Dynamsoft/barcode-reader-javascript","owner":"Dynamsoft","description":"Dynamsoft Barcode Reader JavaScript SDK for package managers. PDF417, QR Code, DataMatrix, MaxiCode and more are supported.","archived":false,"fork":false,"pushed_at":"2025-04-24T07:38:23.000Z","size":128579,"stargazers_count":179,"open_issues_count":9,"forks_count":108,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-05-15T05:08:01.691Z","etag":null,"topics":["1d-barcode","aztec-code","barcode","barcode-reader","html5-barcode","javascript","javascript-barcode","javascript-qrcode","linear-barcode","npm-package","pdf417","qrcode","sdk","web","web-barcode","webassembly"],"latest_commit_sha":null,"homepage":"https://www.dynamsoft.com/barcode-reader/sdk-javascript/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dynamsoft.png","metadata":{"files":{"readme":"README.html","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-08-22T08:57:56.000Z","updated_at":"2025-04-24T07:38:10.000Z","dependencies_parsed_at":"2024-01-16T10:37:25.397Z","dependency_job_id":"f5411bb3-b8ad-47c0-ae62-f71d275f7ab7","html_url":"https://github.com/Dynamsoft/barcode-reader-javascript","commit_stats":{"total_commits":63,"total_committers":7,"mean_commits":9.0,"dds":0.4285714285714286,"last_synced_commit":"0c1ea79c97d79058797f3b70faa30f026dde6db0"},"previous_names":["dynamsoft/javascript-barcode","dynamsoft-dbr/javascript-barcode"],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dynamsoft%2Fbarcode-reader-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dynamsoft%2Fbarcode-reader-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dynamsoft%2Fbarcode-reader-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dynamsoft%2Fbarcode-reader-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dynamsoft","download_url":"https://codeload.github.com/Dynamsoft/barcode-reader-javascript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254276447,"owners_count":22043867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["1d-barcode","aztec-code","barcode","barcode-reader","html5-barcode","javascript","javascript-barcode","javascript-qrcode","linear-barcode","npm-package","pdf417","qrcode","sdk","web","web-barcode","webassembly"],"created_at":"2024-10-09T01:08:03.363Z","updated_at":"2025-12-12T04:24:22.361Z","avatar_url":"https://github.com/Dynamsoft.png","language":null,"readme":"\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eDynamsoft Barcode Reader for Your Website - User Guide\u003c/title\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\"\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cstyle type='text/css'\u003e\n      body {\n        font: 400 16px/1.5 \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n        color: #111;\n        background-color: #fbfbfb;\n        -webkit-text-size-adjust: 100%;\n        -webkit-font-feature-settings: \"kern\" 1;\n        -moz-font-feature-settings: \"kern\" 1;\n        -o-font-feature-settings: \"kern\" 1;\n        font-feature-settings: \"kern\" 1;\n        font-kerning: normal;\n        padding: 30px;\n      }\n      \n      @media only screen and (max-width: 600px) {\n        body {\n            padding: 5px;\n        }\n        body\u003e#content {\n            padding: 0px 20px 20px 20px !important;\n        }\n      }\n      \n      body\u003e#content {\n        margin: 0px;\n        max-width: 900px;\n        border: 1px solid #e1e4e8;\n        padding: 10px 40px;\n        padding-bottom: 20px;\n        border-radius: 2px;\n        margin-left: auto;\n        margin-right: auto;\n      }\n      \n      hr {\n        color: #bbb;\n        background-color: #bbb;\n        height: 1px;\n        flex: 0 1 auto;\n        margin: 1em 0;\n        padding: 0;\n        border: none;\n      }\n      \n      \n      /**\n      * Links\n      */\n      \n      a {\n        color: #0366d6;\n        text-decoration: none;\n      }\n      \n      a:visited {\n        color: #0366d6;\n      }\n      \n      a:hover {\n        color: #0366d6;\n        text-decoration: underline;\n      }\n      \n      pre {\n        background-color: #f6f8fa;\n        border-radius: 3px;\n        font-size: 85%;\n        line-height: 1.45;\n        overflow: auto;\n        padding: 16px;\n      }\n      \n      \n      /**\n      * Code blocks\n      */\n      \n      code {\n        background-color: rgba(27, 31, 35, .05);\n        border-radius: 3px;\n        font-size: 85%;\n        margin: 0;\n        word-wrap: break-word;\n        padding: .2em .4em;\n        font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;\n      }\n      \n      pre\u003ecode {\n        background-color: transparent;\n        border: 0;\n        display: inline;\n        line-height: inherit;\n        margin: 0;\n        overflow: visible;\n        padding: 0;\n        word-wrap: normal;\n        font-size: 100%;\n      }\n      \n      \n      /**\n      * Blockquotes\n      */\n      \n      blockquote {\n        margin-left: 30px;\n        margin-top: 0px;\n        margin-bottom: 16px;\n        border-left-width: 3px;\n        padding: 0 1em;\n        color: #828282;\n        border-left: 4px solid #e8e8e8;\n        padding-left: 15px;\n        font-size: 18px;\n        letter-spacing: -1px;\n        font-style: italic;\n      }\n      \n      blockquote * {\n        font-style: normal !important;\n        letter-spacing: 0;\n        color: #6a737d !important;\n      }\n      \n      \n      /**\n      * Tables\n      */\n      \n      table {\n        border-spacing: 2px;\n        display: block;\n        font-size: 14px;\n        overflow: auto;\n        width: 100%;\n        margin-bottom: 16px;\n        border-spacing: 0;\n        border-collapse: collapse;\n      }\n      \n      td {\n        padding: 6px 13px;\n        border: 1px solid #dfe2e5;\n      }\n      \n      th {\n        font-weight: 600;\n        padding: 6px 13px;\n        border: 1px solid #dfe2e5;\n      }\n      \n      tr {\n        background-color: #fff;\n        border-top: 1px solid #c6cbd1;\n      }\n      \n      table tr:nth-child(2n) {\n        background-color: #f6f8fa;\n      }\n      \n      \n      /**\n      * Others\n      */\n      \n      img {\n        max-width: 100%;\n      }\n      \n      p {\n        line-height: 24px;\n        font-weight: 400;\n        font-size: 16px;\n        color: #24292e;\n      }\n      \n      ul {\n        margin-top: 0;\n      }\n      \n      li {\n        color: #24292e;\n        font-size: 16px;\n        font-weight: 400;\n        line-height: 1.5;\n      }\n      \n      li+li {\n        margin-top: 0.25em;\n      }\n      \n      * {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n        color: #24292e;\n      }\n      \n      a:visited {\n        color: #0366d6;\n      }\n      \n      h1,\n      h2,\n      h3 {\n        border-bottom: 1px solid #eaecef;\n        color: #111;\n        /* Darker */\n      }\n      \n      code\u003e* {\n        font-family: Consolas, \"Liberation Mono\", Menlo, Courier, monospace !important;\n      }\n    \u003c/style\u003e\n    \u003cstyle type='text/css'\u003epre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#383a42;background:#fafafa}.hljs-comment,.hljs-quote{color:#a0a1a7;font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword{color:#a626a4}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#e45649}.hljs-literal{color:#0184bb}.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#50a14f}.hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#986801}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#4078f2}.hljs-built_in,.hljs-class .hljs-title,.hljs-title.class_{color:#c18401}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline}\u003c/style\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv id='content'\u003e\n\u003ch1 id=\"build-a-web-based-barcode-scanner-using-just-a-few-lines-of-javascript\"\u003eBuild a Web-Based Barcode Scanner Using Just a Few Lines of JavaScript\u003c/h1\u003e\n\u003c!-- Don't forget to add the TOC \u0026 update license section, which is useful for npm README.--\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"#build-a-web-based-barcode-scanner-using-just-a-few-lines-of-javascript\"\u003eBuild a Web-Based Barcode Scanner Using Just a Few Lines of JavaScript\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#quick-start-hello-world-example\"\u003eQuick Start: Hello World Example\u003c/a\u003e\u003cul\u003e\n\u003cli\u003e\u003ca href=\"#step-1-setting-up-the-html-and-including-the-barcode-scanner\"\u003eStep 1: Setting up the HTML and Including the Barcode Scanner\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#step-2-initializing-the-barcode-scanner\"\u003eStep 2: Initializing the Barcode Scanner\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#step-3-launching-the-barcode-scanner\"\u003eStep 3: Launching the Barcode Scanner\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#next-steps\"\u003eNext Steps\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThis user guide provides a step-by-step walkthrough of a \"Hello World\" web application using the \u003ccode\u003eBarcodeScanner\u003c/code\u003e JavaScript Edition.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003eBarcodeScanner\u003c/code\u003e class offers the following features:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cp\u003eHigh-level APIs that deliver core functionality with a single line of code.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003ePre-built UI components for fast and easy integration.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eIntuitive configuration objects that streamline both algorithm and UI setup.\u003c/p\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eWe recommend using this guide as a reference when creating your own application. If you are looking for a fully customizable barcode decoding library, you are welcome to use the \u003ca href=\"https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/user-guide/index.html\"\u003eFoundational APIs\u003c/a\u003e. Before starting, ensure the \u003cstrong\u003ebasic requirements\u003c/strong\u003e are met.\u003c/p\u003e\n\u003c!-- \nThanks to its simplified APIs and built-in UI for video streaming, you can implement basic scanning functionality with just one line of code:\n\u003cpre\u003e\u003ccode class=\"hljs js language-js\"\u003e\u003cspan class=\"hljs-keyword\"\u003enew\u003c/span\u003e Dynamsoft.BarcodeScanner().launch().then(\u003cspan class=\"hljs-function\"\u003e\u003cspan class=\"hljs-params\"\u003eresult\u003c/span\u003e=\u0026gt;\u003c/span\u003ealert(result.barcodeResults[\u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e].text));\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp align=\"center\" style=\"text-align:center; white-space: normal; \"\u003e\n  \u003ca target=\"_blank\" href=\"https://jsfiddle.net/DynamsoftTeam/csm2f9wb/\" title=\"Run via JSFiddle\" style=\"text-decoration:none;\"\u003e\n    \u003cimg src=\"https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/jsfiddle.svg\" alt=\"Run via JSFiddle\" width=\"20\" height=\"20\" style=\"width:20px;height:20px;\" \u003e\n  \u003c/a\u003e\n\u003c/p\u003e \n--\u003e\n\u003cul\u003e\n\u003cli\u003eInternet connection\u003c/li\u003e\n\u003cli\u003eA supported browser\u003c/li\u003e\n\u003cli\u003eCamera access\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n  \u003cp\u003e[!TIP]\u003cbr /\u003e\n  Please refer to \u003ca href=\"https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/faq/system-requirement.html\"\u003esystem requirements\u003c/a\u003e for more details.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003ch2 id=\"license\"\u003eLicense\u003c/h2\u003e\n\u003cp\u003eWhen getting started with Barcode Scanner, we recommend \u003ca href=\"https://www.dynamsoft.com/customer/license/trialLicense/?product=dbr\u0026utm_source=github\u0026package=js\"\u003egetting your own 30-day trial license\u003c/a\u003e\u003c/p\u003e\n\u003c!-- When getting started with Barcode Scanner, we recommend getting your own 30-day trial license.\n\n {% include trialLicense.html %} --\u003e\n\u003ch2 id=\"quick-start-hello-world-example\"\u003eQuick Start: Hello World Example\u003c/h2\u003e\n\u003cpre\u003e\u003ccode class=\"hljs html language-html\"\u003e\u003cspan class=\"hljs-meta\"\u003e\u0026lt;!DOCTYPE \u003cspan class=\"hljs-meta-keyword\"\u003ehtml\u003c/span\u003e\u0026gt;\u003c/span\u003e\n\u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003ehtml\u003c/span\u003e \u003cspan class=\"hljs-attr\"\u003elang\u003c/span\u003e=\u003cspan class=\"hljs-string\"\u003e\u0026quot;en\u0026quot;\u003c/span\u003e\u0026gt;\u003c/span\u003e\n  \u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003ebody\u003c/span\u003e\u0026gt;\u003c/span\u003e\n    \u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e \u003cspan class=\"hljs-attr\"\u003esrc\u003c/span\u003e=\u003cspan class=\"hljs-string\"\u003e\u0026quot;https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@11.2.4000/dist/dbr.bundle.js\u0026quot;\u003c/span\u003e\u0026gt;\u003c/span\u003e\u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e\u0026gt;\u003c/span\u003e\n    \u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e\u0026gt;\u003c/span\u003e\u003cspan class=\"javascript\"\u003e\n      \u003cspan class=\"hljs-comment\"\u003e// Initialize the Dynamsoft Barcode Scanner\u003c/span\u003e\n      \u003cspan class=\"hljs-keyword\"\u003econst\u003c/span\u003e barcodeScanner = \u003cspan class=\"hljs-keyword\"\u003enew\u003c/span\u003e Dynamsoft.BarcodeScanner({\n        \u003cspan class=\"hljs-comment\"\u003e// Please don\u0026#x27;t forget to replace YOUR_LICENSE_KEY_HERE\u003c/span\u003e\n        \u003cspan class=\"hljs-attr\"\u003elicense\u003c/span\u003e: \u003cspan class=\"hljs-string\"\u003e\u0026quot;YOUR_LICENSE_KEY_HERE\u0026quot;\u003c/span\u003e,\n      });\n      (\u003cspan class=\"hljs-keyword\"\u003easync\u003c/span\u003e () =\u0026gt; {\n        \u003cspan class=\"hljs-comment\"\u003e// Launch the scanner and wait for the result\u003c/span\u003e\n        \u003cspan class=\"hljs-keyword\"\u003econst\u003c/span\u003e result = \u003cspan class=\"hljs-keyword\"\u003eawait\u003c/span\u003e barcodeScanner.launch();\n        \u003cspan class=\"hljs-comment\"\u003e// Display the first detected barcode\u0026#x27;s text in an alert\u003c/span\u003e\n        \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e (result.barcodeResults.length) {\n            alert(result.barcodeResults[\u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e].text);\n        }\n      })();\n    \u003c/span\u003e\u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e\u0026gt;\u003c/span\u003e\n  \u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003ebody\u003c/span\u003e\u0026gt;\u003c/span\u003e\n\u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003ehtml\u003c/span\u003e\u0026gt;\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp align=\"center\" style=\"text-align:center; white-space: normal; \"\u003e\n  \u003ca target=\"_blank\" href=\"https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v11.2.40/barcode-scanner-api-samples/scan-single-barcode/hello-world.html\" title=\"Code in Github\" style=\"text-decoration:none;\"\u003e\n    \u003cimg src=\"https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/github.svg\" alt=\"Code in Github\" width=\"20\" height=\"20\" style=\"width:20px;height:20px;\"\u003e\n  \u003c/a\u003e\n  \u0026nbsp;\n  \u003ca target=\"_blank\" href=\"https://jsfiddle.net/DynamsoftTeam/gcqjf5r7/\" title=\"Run via JSFiddle\" style=\"text-decoration:none;\"\u003e\n    \u003cimg src=\"https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/jsfiddle.svg\" alt=\"Run via JSFiddle\" width=\"20\" height=\"20\" style=\"width:20px;height:20px;\" \u003e\n  \u003c/a\u003e\n  \u0026nbsp;\n  \u003ca target=\"_blank\" href=\"https://demo.dynamsoft.com/Samples/DBR/JS/barcode-scanner-api-samples/scan-single-barcode/hello-world.html?ver=11.2.40\u0026utm_source=github\" title=\"Run in Dynamsoft\" style=\"text-decoration:none;\"\u003e\n    \u003cimg src=\"https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.0.0/svgs/solid/circle-play.svg\" alt=\"Run in Dynamsoft\" width=\"20\" height=\"20\" style=\"width:20px;height:20px;\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003ch3 id=\"step-1-setting-up-the-html-and-including-the-barcode-scanner\"\u003eStep 1: Setting up the HTML and Including the Barcode Scanner\u003c/h3\u003e\n\u003cp\u003eAs outlined earlier, this guide will help you create a simple Hello World barcode scanning application using vanilla JavaScript. The full sample code is also available in the \u003ca href=\"https://github.com/Dynamsoft/barcode-reader-javascript-samples/tree/v11.2.40\"\u003eGitHub repository\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eThe first step before writing the code is to include the SDK in your application. You can simply include the SDK by using the precompiled script.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs html language-html\"\u003e\u003cspan class=\"hljs-meta\"\u003e\u0026lt;!DOCTYPE \u003cspan class=\"hljs-meta-keyword\"\u003ehtml\u003c/span\u003e\u0026gt;\u003c/span\u003e\n\u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003ehtml\u003c/span\u003e \u003cspan class=\"hljs-attr\"\u003elang\u003c/span\u003e=\u003cspan class=\"hljs-string\"\u003e\u0026quot;en\u0026quot;\u003c/span\u003e\u0026gt;\u003c/span\u003e\n  \u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003ebody\u003c/span\u003e\u0026gt;\u003c/span\u003e\n    \u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e \u003cspan class=\"hljs-attr\"\u003esrc\u003c/span\u003e=\u003cspan class=\"hljs-string\"\u003e\u0026quot;https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@11.2.4000/dist/dbr.bundle.js\u0026quot;\u003c/span\u003e\u0026gt;\u003c/span\u003e\u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e\u0026gt;\u003c/span\u003e\n  \u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003ebody\u003c/span\u003e\u0026gt;\u003c/span\u003e\n\u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003ehtml\u003c/span\u003e\u0026gt;\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eIn this example, we include the precompiled Barcode Scanner SDK script via public CDN in the body.\u003c/p\u003e\n\u003cdiv class=\"multi-panel-switching-prefix\"\u003e\u003c/div\u003e\n\u003cdiv class=\"multi-panel-start\"\u003e\u003c/div\u003e\n\u003cdiv class=\"multi-panel-title\"\u003eUse a public CDN\u003c/div\u003e\n\u003cp\u003eThe simplest way to include the SDK is to use either the \u003ca href=\"https://jsdelivr.com/\"\u003e\u003cstrong\u003ejsDelivr\u003c/strong\u003e\u003c/a\u003e or \u003ca href=\"https://unpkg.com/\"\u003e\u003cstrong\u003eUNPKG\u003c/strong\u003e\u003c/a\u003e CDN.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003ejsDelivr\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode class=\"hljs html language-html\"\u003e  \u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e \u003cspan class=\"hljs-attr\"\u003esrc\u003c/span\u003e=\u003cspan class=\"hljs-string\"\u003e\u0026quot;https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@11.2.4000/dist/dbr.bundle.js\u0026quot;\u003c/span\u003e\u0026gt;\u003c/span\u003e\u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e\u0026gt;\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cul\u003e\n\u003cli\u003eUNPKG\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode class=\"hljs html language-html\"\u003e  \u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e \u003cspan class=\"hljs-attr\"\u003esrc\u003c/span\u003e=\u003cspan class=\"hljs-string\"\u003e\u0026quot;https://unpkg.com/dynamsoft-barcode-reader-bundle@11.2.4000/dist/dbr.bundle.js\u0026quot;\u003c/span\u003e\u0026gt;\u003c/span\u003e\u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e\u0026gt;\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eWhen using a framework such as \u003cstrong\u003eReact\u003c/strong\u003e, \u003cstrong\u003eVue\u003c/strong\u003e or \u003cstrong\u003eAngular\u003c/strong\u003e, we recommend adding the package as a dependency using a package manager such as \u003cstrong\u003enpm\u003c/strong\u003e or \u003cstrong\u003eyarn\u003c/strong\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs sh language-sh\"\u003e  npm i dynamsoft-barcode-reader-bundle@11.2.4000\n  \u003cspan class=\"hljs-comment\"\u003e# or\u003c/span\u003e\n  yarn add dynamsoft-barcode-reader-bundle@11.2.4000\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eWhen using package managers like \u003cstrong\u003enpm\u003c/strong\u003e or \u003cstrong\u003eyarn\u003c/strong\u003e, you likely need to specify the location of the engine files as a link to a CDN. Please see the \u003ca href=\"https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/barcode-scanner.html#barcodescannerconfig\"\u003eBarcodeScannerConfig API\u003c/a\u003e for a code snippet on how to set the \u003ccode\u003eengineResourcePaths\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"multi-panel-end\"\u003e\u003c/div\u003e\n\u003cdiv class=\"multi-panel-start\"\u003e\u003c/div\u003e\n\u003cdiv class=\"multi-panel-title\"\u003eHost the SDK yourself\u003c/div\u003e\n\u003cp\u003eAlternatively, you may choose to download the SDK and host the files on your own server or preferred CDN. This approach provides better control over versioning and availability.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cp\u003eFrom the website\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://www.dynamsoft.com/barcode-reader/downloads/?ver=11.2.40\u0026utm_source=github\u0026product=dbr\u0026package=js\"\u003eDownload Dynamsoft Barcode Reader JavaScript Package\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eThe resources are located in the \u003ccode\u003e./dist/\u003c/code\u003e directory.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eFrom npm\u003c/p\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode class=\"hljs sh language-sh\"\u003e  npm i dynamsoft-barcode-reader-bundle@11.2.4000\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThe resources are located at the path \u003ccode\u003enode_modules/\u0026lt;pkg\u0026gt;\u003c/code\u003e, without \u003ccode\u003e@\u0026lt;version\u0026gt;\u003c/code\u003e. You can copy it elsewhere and add \u003ccode\u003e@\u0026lt;version\u0026gt;\u003c/code\u003e tag.\u003c/p\u003e\n\u003cblockquote\u003e\n  \u003cp\u003e[!IMPORTANT]\u003cbr /\u003e\n  Since \"node\u003cem\u003emodules\" is reserved for Node.js dependencies, and in our case the package is used only as static resources, we recommend either renaming the \"node\u003c/em\u003emodules\" folder or moving the \"dynamsoft-\" packages to a dedicated folder for static resources in your project to facilitate self-hosting.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eYou can typically include the SDK like this:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs html language-html\"\u003e\u003cspan class=\"hljs-tag\"\u003e\u0026lt;\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e \u003cspan class=\"hljs-attr\"\u003esrc\u003c/span\u003e=\u003cspan class=\"hljs-string\"\u003e\u0026quot;path/to/dynamsoft-barcode-reader-bundle@11.2.4000/dist/dbr.bundle.js\u0026quot;\u003c/span\u003e\u0026gt;\u003c/span\u003e\u003cspan class=\"hljs-tag\"\u003e\u0026lt;/\u003cspan class=\"hljs-name\"\u003escript\u003c/span\u003e\u0026gt;\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cdiv class=\"multi-panel-end\"\u003e\u003c/div\u003e\n\u003cdiv class=\"multi-panel-switching-end\"\u003e\u003c/div\u003e\n\u003cp\u003eBarcode Scanner comes with a \u003cstrong\u003eReady-to-Use UI\u003c/strong\u003e. When the Barcode Scanner launches, it creates a container which it populates with the \u003cstrong\u003eReady-to-Use UI\u003c/strong\u003e.\u003c/p\u003e\n\u003ch3 id=\"step-2-initializing-the-barcode-scanner\"\u003eStep 2: Initializing the Barcode Scanner\u003c/h3\u003e\n\u003cpre\u003e\u003ccode class=\"hljs js language-js\"\u003e\u003cspan class=\"hljs-comment\"\u003e// Initialize the Dynamsoft Barcode Scanner\u003c/span\u003e\n\u003cspan class=\"hljs-keyword\"\u003econst\u003c/span\u003e barcodeScanner = \u003cspan class=\"hljs-keyword\"\u003enew\u003c/span\u003e Dynamsoft.BarcodeScanner({\n  \u003cspan class=\"hljs-comment\"\u003e// Please don\u0026#x27;t forget to replace YOUR_LICENSE_KEY_HERE\u003c/span\u003e\n  \u003cspan class=\"hljs-attr\"\u003elicense\u003c/span\u003e: \u003cspan class=\"hljs-string\"\u003e\u0026quot;YOUR_LICENSE_KEY_HERE\u0026quot;\u003c/span\u003e,\n});\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThis is the \u003cstrong\u003esimplest\u003c/strong\u003e way to initialize the Barcode Scanner. The configuration object must include a valid \u003cstrong\u003elicense\u003c/strong\u003e key. Without it, the scanner will fail to launch and display an error. For help obtaining a license, see the \u003ca href=\"#license\"\u003elicensing\u003c/a\u003e section.\u003c/p\u003e\n\u003cblockquote\u003e\n  \u003cp\u003e[!TIP]\u003cbr /\u003e\n  By default, the \u003ccode\u003eBarcodeScanner\u003c/code\u003e scans a single barcode at a time. However, it also supports a \u003ccode\u003eMULTI_UNIQUE\u003c/code\u003e scanning mode, which continuously scans and accumulates unique results in real time. You can enable this mode by modifying the \u003ca href=\"https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/barcode-scanner.html#barcodescannerconfig\"\u003e\u003ccode\u003eBarcodeScannerConfig\u003c/code\u003e\u003c/a\u003e as follows:\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cpre\u003e\u003ccode class=\"hljs js language-js\"\u003e\u003cspan class=\"hljs-comment\"\u003e// Initialize the Dynamsoft Barcode Scanner in MULTI_UNIQUE mode\u003c/span\u003e\n\u003cspan class=\"hljs-keyword\"\u003econst\u003c/span\u003e barcodeScanner = \u003cspan class=\"hljs-keyword\"\u003enew\u003c/span\u003e Dynamsoft.BarcodeScanner({\n  \u003cspan class=\"hljs-attr\"\u003elicense\u003c/span\u003e: \u003cspan class=\"hljs-string\"\u003e\u0026quot;YOUR_LICENSE_KEY_HERE\u0026quot;\u003c/span\u003e,\n  \u003cspan class=\"hljs-attr\"\u003escanMode\u003c/span\u003e: Dynamsoft.EnumScanMode.SM_MULTI_UNIQUE,\n});\n\u003c/code\u003e\u003c/pre\u003e\n\u003ch3 id=\"step-3-launching-the-barcode-scanner\"\u003eStep 3: Launching the Barcode Scanner\u003c/h3\u003e\n\u003cpre\u003e\u003ccode class=\"hljs js language-js\"\u003e(\u003cspan class=\"hljs-keyword\"\u003easync\u003c/span\u003e () =\u0026gt; {\n  \u003cspan class=\"hljs-comment\"\u003e// Launch the scanner and wait for the result\u003c/span\u003e\n  \u003cspan class=\"hljs-keyword\"\u003econst\u003c/span\u003e result = \u003cspan class=\"hljs-keyword\"\u003eawait\u003c/span\u003e barcodeScanner.launch();\n  \u003cspan class=\"hljs-comment\"\u003e// Display the first detected barcode\u0026#x27;s text in an alert\u003c/span\u003e\n  \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e (result.barcodeResults.length) {\n      alert(result.barcodeResults[\u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e].text);\n  }\n})();\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eNow that the Barcode Scanner has been initialized and configured, it is ready to be launched! Upon launch, the Barcode Scanner presents the main \u003cstrong\u003e\u003ccode\u003eBarcodeScannerView\u003c/code\u003e\u003c/strong\u003e UI in its container on the page, and is ready to start scanning. By default, we use the \u003ccode\u003eSINGLE\u003c/code\u003e scanning mode, which means only one decoding result will be included in the final result. In the code above, we directly alerted the successfully decoded barcode text on the page.\u003c/p\u003e\n\u003cblockquote\u003e\n  \u003cp\u003e[!NOTE]\u003cbr /\u003e\n  In the Hello World sample, after a successful decoding process, 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 Barcode Scanner upon closing it.\u003c/p\u003e\n  \u003cp\u003e[!TIP]\u003cbr /\u003e\n  When running performance benchmarks, make sure to disable the console, avoid using \u003ccode\u003econsole.log()\u003c/code\u003e, and run in non-debug mode whenever possible. This ensures that your benchmark results reflect true performance without interference from logging or debugging overhead.\u003c/p\u003e\n  \u003ch2 id=\"next-steps\"\u003eNext Steps\u003c/h2\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eNow that you've implemented the basic functionality, here are some recommended next steps to further explore the capabilities of the Barcode Scanner:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eLearn how to \u003ca href=\"https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/user-guide/barcode-scanner-customization.html\"\u003eCustomize the Barcode Scanner\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003eCheck out the \u003ca href=\"https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/samples-demos/index.html?ver=11.2.4000\"\u003eOfficial Samples and Demo\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003eLearn about the \u003ca href=\"https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/barcode-scanner.html?ver=11.2.4000\"\u003eAPIs of BarcodeScanner\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n    \u003c/div\u003e\n  \u003c/body\u003e\n\u003c/html\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdynamsoft%2Fbarcode-reader-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdynamsoft%2Fbarcode-reader-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdynamsoft%2Fbarcode-reader-javascript/lists"}