@idpass/smartscanner-capacitor 0.7.3-beta.4 → 0.7.3-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -65,7 +65,7 @@ const result = await SmartScannerPlugin.executeScanner({
65
65
  });
66
66
 
67
67
  ```
68
- Table OCR scanning example:
68
+ Table OCR scanning example (attendance table):
69
69
 
70
70
  ```js
71
71
  const result = await SmartScannerPlugin.executeScanner({
@@ -75,24 +75,17 @@ const result = await SmartScannerPlugin.executeScanner({
75
75
  ocrOptions: {
76
76
  analyzeStart: 1000,
77
77
  tableConfig: {
78
- // Column headers to search for in OCR text (left-to-right order)
79
- columnHeaders: ['Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'Apr', 'Total'],
80
- // Auto-detect which month columns are actually present in the scanned image
78
+ // Months and Total column are auto-detected from the table grid
79
+ columnHeaders: [],
81
80
  autoDetectMonths: true,
82
- // Number of data rows below the headers
81
+ // Number of data rows and their labels
83
82
  dataRows: 3,
84
- // Row labels found on the left side of each data row
85
83
  rowLabels: ['School', 'Present', 'Absent'],
86
- // Regex filter applied to every extracted cell value
84
+ // Cell validation
87
85
  regex: '[0-9]{1,2}',
88
- // Minimum and maximum valid cell values (for days 1-31)
89
86
  validMin: 1,
90
87
  validMax: 31,
91
- // Column index (0-based) exempt from min/max validation (e.g., the Total column)
92
- totalColumnIndex: 11,
93
- // Cell-level value transforms (map common letter-to-digit OCR confusions)
94
88
  transforms: ['LETTER_TO_DIGIT'],
95
- // Table-level post-processing (fills missing months, infers rows, formats as "row.col" keys)
96
89
  tableTransforms: ['ATTENDANCE'],
97
90
  },
98
91
  },
@@ -100,25 +93,23 @@ const result = await SmartScannerPlugin.executeScanner({
100
93
  background: '#89837c',
101
94
  branding: true,
102
95
  label: 'Table OCR',
103
- isManualCapture: true, // user taps the capture button
104
- showOcrGuide: true, // show the scan region overlay
105
- showOcrRegions: true, // highlight detected table cells
106
- orientation: 'landscape',
107
- widthGuide: 900, // guide overlay width in pixels
108
- heightGuide: 500, // guide overlay height in pixels
109
- xGuide: 0.5, // horizontal center offset (0.0-1.0)
110
- yGuide: 0.5, // vertical center offset (0.0-1.0)
96
+ isManualCapture: true,
97
+ showOcrGuide: true,
98
+ showOcrRegions: true,
99
+ orientation: 'portrait',
100
+ widthGuide: 900,
101
+ heightGuide: 400,
102
+ xGuide: 0.5,
103
+ yGuide: 0.5,
111
104
  },
112
105
  },
113
106
  });
114
107
 
115
- // The result is returned as flat "row.col" keys when using the ATTENDANCE transform.
116
- // For example:
117
- // {
118
- // "school.jun": "22", "school.jul": "20", ..., "school.total": "198",
119
- // "present.jun": "20", "present.jul": "18", ..., "present.total": "178",
120
- // "absent.jun": "2", "absent.jul": "2", ..., "absent.total": "20"
121
- // }
108
+ // result.scanner_result.fields contains flat "row.col" keys:
109
+ // { "school.jun": "22", "school.jul": "20", ..., "school.total": "198", ... }
110
+ //
111
+ // result.table_meta contains the auto-detected table structure:
112
+ // { columnHeaders: ["Jun","Jul",...,"Total"], rowLabels: ["School","Present","Absent"], ... }
122
113
  ```
123
114
 
124
115
  A runnable Vue 3 + Vite example is available in the [`example/`](./example) folder.
@@ -24,9 +24,6 @@ allprojects {
24
24
  mavenCentral()
25
25
  maven { url "https://maven.google.com" }
26
26
  maven { url 'https://jitpack.io' }
27
- flatDir {
28
- dirs 'libs'
29
- }
30
27
  }
31
28
  }
32
29
 
@@ -60,12 +57,13 @@ android {
60
57
  kotlinOptions {
61
58
  jvmTarget = '21'
62
59
  }
63
- lintOptions {
60
+ lint {
64
61
  abortOnError false
65
62
  }
66
- packagingOptions {
67
- exclude 'META-INF/NOTICE'
68
- exclude 'META-INF/LICENSE'
63
+ packaging {
64
+ resources {
65
+ excludes += ['META-INF/NOTICE', 'META-INF/LICENSE']
66
+ }
69
67
  }
70
68
  }
71
69
 
@@ -76,9 +74,9 @@ dependencies {
76
74
 
77
75
  implementation project(':capacitor-android')
78
76
 
79
- debugImplementation(name: 'smartscannerlib-debug', ext: 'aar')
80
- releaseImplementation(name: 'smartscannerlib-release', ext: 'aar')
81
- implementation(name: 'smartscanner-mrz-parser', ext: 'aar')
77
+ debugImplementation(files('libs/smartscannerlib-debug.aar'))
78
+ releaseImplementation(files('libs/smartscannerlib-release.aar'))
79
+ implementation(files('libs/smartscanner-mrz-parser.aar'))
82
80
 
83
81
  testImplementation "junit:junit:$junitVersion"
84
82
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
@@ -93,8 +91,8 @@ dependencies {
93
91
  implementation 'androidx.preference:preference-ktx:1.2.1'
94
92
 
95
93
  // ML Kit dependencies
96
- implementation 'com.google.mlkit:text-recognition:16.0.0-beta6'
97
- implementation 'com.google.mlkit:barcode-scanning:17.2.0'
94
+ implementation 'com.google.mlkit:text-recognition:16.0.1'
95
+ implementation 'com.google.mlkit:barcode-scanning:17.3.0'
98
96
 
99
97
  // Glide
100
98
  implementation 'com.github.bumptech.glide:glide:4.12.0'
@@ -54,6 +54,11 @@ class SmartScannerPlugin : Plugin() {
54
54
  val scannerResult = JSONObject(returnedResult)
55
55
  val ret = JSObject()
56
56
  ret.put(SmartScannerActivity.SCANNER_RESULT, scannerResult)
57
+ // Include table metadata (detected months, row labels) if available
58
+ val tableMeta = result.data?.getStringExtra("table_meta")
59
+ if (tableMeta != null) {
60
+ try { ret.put("table_meta", JSONObject(tableMeta)) } catch (_: JSONException) {}
61
+ }
57
62
  call.resolve(ret)
58
63
  } else {
59
64
  Timber.d("SmartScanner: RESULT SCANNING NULL")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idpass/smartscanner-capacitor",
3
- "version": "0.7.3-beta.4",
3
+ "version": "0.7.3-beta.6",
4
4
  "description": "Capacitor plugin for the SmartScanner Core library to scan MRZ, NFC and barcodes",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",