You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library is built to provide a solution scanner QR code.
This library takes in raw images and will locate, extract and parse any QR code found within.
This demo Github, Stackblitz.
Supported Barcode Types
QR Code
Code-39
Code-93
Code-128
Codabar
Databar/Expanded
EAN/GTIN-5/8/13
ISBN-10/13
ISBN-13+2
ISBN-13+5
ITF (Interleaved 2 of 5)
UPC-A/E.
Installation
Install ngx-scanner-qrcode from npm:
npm install ngx-scanner-qrcode@<version> --save
Add wanted package to NgModule imports:
import{NgxScannerQrcodeModule,LOAD_WASM}from'ngx-scanner-qrcode';// Necessary to solve the problem of losing internet connectionLOAD_WASM().subscribe();
@NgModule({imports: [NgxScannerQrcodeModule]})
angular.json
{
"architect": {
"build": {
"options": {
"assets": [
/* Necessary to solve the problem of losing internet connection */
{
"glob": "**/*",
"input": "node_modules/ngx-scanner-qrcode/wasm/",
"output": "./assets/wasm/"
}
]
}
}
}
}
In the Component:
<!-- For camera --><ngx-scanner-qrcode#action="scanner"></ngx-scanner-qrcode><!-- data --><span>{{ action.data.value | json }}</span><!-- value --><span>{{ action.data | async | json }}</span><!-- async --><!-- Loading --><p*ngIf="action.isLoading">⌛ Loading...</p><!-- start --><button(click)="action.isStart ? action.stop() : action.start()">{{action.isStart ? 'Stop' : 'Start'}}</button>
Image src
<!-- For image src --><ngx-scanner-qrcode#action="scanner" [src]="'https://domain.com/test.png'"></ngx-scanner-qrcode><span>{{ action.data.value | json }}</span><!-- value --><span>{{ action.data | async | json }}</span><!-- async -->
enumScannerQRCodeSymbolType{ScannerQRCode_NONE=0,/**< no symbol decoded */ScannerQRCode_PARTIAL=1,/**< intermediate status */ScannerQRCode_EAN2=2,/**< GS1 2-digit add-on */ScannerQRCode_EAN5=5,/**< GS1 5-digit add-on */ScannerQRCode_EAN8=8,/**< EAN-8 */ScannerQRCode_UPCE=9,/**< UPC-E */ScannerQRCode_ISBN10=10,/**< ISBN-10 (from EAN-13). @since 0.4 */ScannerQRCode_UPCA=12,/**< UPC-A */ScannerQRCode_EAN13=13,/**< EAN-13 */ScannerQRCode_ISBN13=14,/**< ISBN-13 (from EAN-13). @since 0.4 */ScannerQRCode_COMPOSITE=15,/**< EAN/UPC composite */ScannerQRCode_I25=25,/**< Interleaved 2 of 5. @since 0.4 */ScannerQRCode_DATABAR=34,/**< GS1 DataBar (RSS). @since 0.11 */ScannerQRCode_DATABAR_EXP=35,/**< GS1 DataBar Expanded. @since 0.11 */ScannerQRCode_CODABAR=38,/**< Codabar. @since 0.11 */ScannerQRCode_CODE39=39,/**< Code 39. @since 0.4 */ScannerQRCode_PDF417=57,/**< PDF417. @since 0.6 */ScannerQRCode_QRCODE=64,/**< QR Code. @since 0.10 */ScannerQRCode_SQCODE=80,/**< SQ Code. @since 0.20.1 */ScannerQRCode_CODE93=93,/**< Code 93. @since 0.11 */ScannerQRCode_CODE128=128,/**< Code 128 *//* * Please see _ScannerQRCode_get_symbol_hash() if adding * anything after 128 *//** mask for base symbol type. * @deprecated in 0.11, remove this from existing code */ScannerQRCode_SYMBOL=0x00ff,/** 2-digit add-on flag. * @deprecated in 0.11, a ::ScannerQRCode_EAN2 component is used for * 2-digit GS1 add-ons */ScannerQRCode_ADDON2=0x0200,/** 5-digit add-on flag. * @deprecated in 0.11, a ::ScannerQRCode_EAN5 component is used for * 5-digit GS1 add-ons */ScannerQRCode_ADDON5=0x0500,/** add-on flag mask. * @deprecated in 0.11, GS1 add-ons are represented using composite * symbols of type ::ScannerQRCode_COMPOSITE; add-on components use ::ScannerQRCode_EAN2 * or ::ScannerQRCode_EAN5 */ScannerQRCode_ADDON=0x0700,}interfaceScannerQRCodePoint{x: number;y: number;}enumScannerQRCodeOrientation{ScannerQRCode_ORIENT_UNKNOWN=-1,/**< unable to determine orientation */ScannerQRCode_ORIENT_UP,/**< upright, read left to right */ScannerQRCode_ORIENT_RIGHT,/**< sideways, read top to bottom */ScannerQRCode_ORIENT_DOWN,/**< upside-down, read right to left */ScannerQRCode_ORIENT_LEFT,/**< sideways, read bottom to top */}