borisous-lib v0.0.62
INSTRUCTIONS FOR IMPLEMENTATION
npm i @fad-producto/argentinian-dni-capture@latest --legacy-peer-deps Pre-instalation: - https://github.com/lgeronimov/fad-modules-install
1 - add skipLibCheck configuration (tsconfig.json)
{ "compilerOptions": { "skipLibCheck": true, ...
2 - import library assets (angular.json)
"architect": {
"build": {
"options": {
"assets": [
{
"glob": "**/*",
"input": "node_modules/@fad-producto/argentinian-dni-capture/assets/tf-models",
"output": "./assets/tf-models"
},
{
"glob": "**/*",
"input": "node_modules/@fad-producto/argentinian-dni-capture/assets/tfLite",
"output": "./"
}
],
"scripts": [
"node_modules/@fad-producto/argentinian-dni-capture/assets/opencv.js"
]
...
3 - Import component - app.module.ts
import { ArgentinianDniCaptureModule } from '@fad-producto/argentinian-dni-capture';
@NgModule({ imports: [ ArgentinianDniCaptureModule,
4 - Component Inputs & Outputs
Inputs
<argentinian-dni-capture
[title]="title"
[debugMode]="false"
[darkMode]="false"
[tfModelPath]="'/assets/tf-models/'"
(onStart)="onStart($event)"
(cameraAccepted)="cameraAccepted()"
(getData)="getData($event)"
(getError)="getError($event)"
(getCloseScanner)="getCloseScanner($event)"
...
| Name | Type | Required | Default | Description |
| ------------ | ------- | -------- | ------- | ------------------------------------------------- |
| title | string | true | | Legend to display before capture |
| debugMode | boolean | false | false | Show capture on display for development reasons |
| darkMode | boolean | false | false | background color screen, dark or light |
| tfModelPath | string | false | null | model path, configure if your href is not default |
Outputs
onStart($event) {
console.log('Scanner onStart ' + $event);
}
cameraAccepted() {
console.log('Scanner acceptCamera event');
}
getData($event) {
console.log('Scanner result: ', $event);
}
getError($event) {
console.log('Scanner error: ', $event);
}
getCloseScanner($event) {
console.log('Cerrando Scanner ' + $event);
}
| Name | Return | Description |
| ---------------- | ---------------------------------- | -------------------------------------------------- |
| onStart | void | Fires when the component is ready |
| cameraAccepted | void | Fires when the user accepts the camera permissions |
| getData | Value of type "DataResponseModel" | Fires when scanning was completed |
| getError | Value of type "ResponseErrorModel" | Fires when an error happens |
| getCloseScanner | void | Fires when the scanner closes |
Data Structure
DataResponseModel
className: string;
probability: number;
innerText: string;
imageBase64 : string;
imageFixed : string;
croppedPhoto : string;
blurred: number;
ResponseErrorModel
error: string; (*ErrorMessages enum)
message: string; (Error string detail)
code: number; (*ErrorCodes enum)
export enum ErrorMessages {
BROWSER_NOT_SUPPORTED = 'Navegador no soportado',
NOT_ACCEPT_CAMERA_PERMISSION = 'No tienes permisos para acceder a la cámara',
MAX_TIME_LIMIT = 'Tiempo máximo superado',
ORIENTATION_TITLE = 'Por favor coloca tu dispositivo de forma vertical',
ORIENTATION_INSTRUCTIONS = 'Te sugerimos bloquear el giro automático en tu dispositivo para una mejor experiencia',
NOT_SUPPORTED_TITLE = 'Atención',
NOT_SUPPORTED_INSTRUCTIONS = 'Este es un navegador no soportado',
NOT_DETECTED = 'No se puede identificar el documento',
NOT_CREATED = 'No fue posible iniciar el componente',
MODEL_ERROR = 'Se presento un error al cargar el modelo de predicción',
PERSPECTIVE_ERROR = 'Se presento un error al interpretar la perspectiva',
}
export enum ErrorCodes {
BROWSER_NOT_SUPPORTED= -1,
NOT_ACCEPT_CAMERA_PERMISSION = -2,
MAX_TIME_LIMIT = -3,
ORIENTATION = -4,
NOT_SUPPORTED = -5,
NOT_DETECTED = -6,
NOT_CREATED = -7,
MODEL_ERROR = -8,
PERSPECTIVE_ERROR = -9
}
Error in project: global is not defined
Add in polyfills.ts
(window as any).global = window;
9 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago