scanbot-web-sdk 3.1.0-alpha.1 → 4.0.0-alpha.2

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.
Files changed (28) hide show
  1. package/@types/document-scanner-view.d.ts +1 -1
  2. package/@types/model/barcode/barcode-format.d.ts +1 -1
  3. package/@types/model/configuration/barcode-count-configuration.d.ts +1 -1
  4. package/@types/model/configuration/document-quality-analyzer-configuration.d.ts +7 -0
  5. package/@types/model/configuration/text-data-scanner-configuration.d.ts +2 -0
  6. package/@types/model/response/document-quality-analyzer-result.d.ts +8 -0
  7. package/@types/scanbot-sdk.d.ts +5 -2
  8. package/@types/service/document-quality-analyzer.d.ts +9 -0
  9. package/@types/service/pdf-generator.d.ts +14 -16
  10. package/bundle/ScanbotSDK.min.js +2 -2
  11. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm-simd.wasm +0 -0
  12. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm.wasm +0 -0
  13. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm.wasm-webpack-file-loader +0 -0
  14. package/bundle/bin/barcode-scanner/ScanbotSDK.Core-simd.js +1 -1
  15. package/bundle/bin/barcode-scanner/ScanbotSDK.Core.js +1 -1
  16. package/bundle/bin/complete/ScanbotSDK.Asm-simd.wasm +0 -0
  17. package/bundle/bin/complete/ScanbotSDK.Asm-simd.wasm-webpack-file-loader +0 -0
  18. package/bundle/bin/complete/ScanbotSDK.Asm.wasm +0 -0
  19. package/bundle/bin/complete/ScanbotSDK.Asm.wasm-webpack-file-loader +0 -0
  20. package/bundle/bin/complete/ScanbotSDK.Core-simd.js +1 -1
  21. package/bundle/bin/complete/ScanbotSDK.Core.js +1 -1
  22. package/bundle/bin/document-scanner/ScanbotSDK.Asm-simd.wasm +0 -0
  23. package/bundle/bin/document-scanner/ScanbotSDK.Asm.wasm +0 -0
  24. package/bundle/bin/document-scanner/ScanbotSDK.Asm.wasm-webpack-file-loader +0 -0
  25. package/bundle/bin/document-scanner/ScanbotSDK.Core-simd.js +1 -1
  26. package/bundle/bin/document-scanner/ScanbotSDK.Core.js +1 -1
  27. package/package.json +2 -2
  28. package/@types/service/blur-detector.d.ts +0 -10
@@ -38,7 +38,7 @@ export default class DocumentScannerView extends ScannerView<DocumentScannerProp
38
38
  * Internal functions
39
39
  */
40
40
  componentDidMount(): Promise<void>;
41
- componentWillUnmount(): void;
41
+ componentWillUnmount(): Promise<void>;
42
42
  detect(): Promise<void>;
43
43
  getStatusString(detectionResult: any): string;
44
44
  detectInWebWorker(): Promise<any>;
@@ -1 +1 @@
1
- export declare type BarcodeFormat = "AZTEC" | "CODABAR" | "CODE_39" | "CODE_93" | "CODE_128" | "DATA_MATRIX" | "EAN_8" | "EAN_13" | "ITF" | "MAXICODE" | "PDF_417" | "QR_CODE" | "RSS_14" | "RSS_EXPANDED" | "UPC_A" | "UPC_E" | "UPC_EAN_EXTENSION" | "MSI_PLESSEY" | "IATA_2_OF_5" | "INDUSTRIAL_2_OF_5" | "CODE_25" | "MICRO_QR_CODE";
1
+ export declare type BarcodeFormat = "AZTEC" | "CODABAR" | "CODE_39" | "CODE_93" | "CODE_128" | "DATA_MATRIX" | "EAN_8" | "EAN_13" | "ITF" | "MAXICODE" | "PDF_417" | "QR_CODE" | "RSS_14" | "RSS_EXPANDED" | "UPC_A" | "UPC_E" | "UPC_EAN_EXTENSION" | "MSI_PLESSEY" | "IATA_2_OF_5" | "INDUSTRIAL_2_OF_5" | "CODE_25" | "MICRO_QR_CODE" | "USPS_INTELLIGENT_MAIL" | "ROYAL_MAIL" | "JAPAN_POST" | "ROYAL_TNT_POST" | "AUSTRALIA_POST" | "DATABAR_LIMITED";
@@ -1,5 +1,5 @@
1
1
  export declare class BarcodeCountStyleConfiguration {
2
- topLabelTop: number;
2
+ topLabelTop?: number;
3
3
  sheetHeight?: string;
4
4
  sheetTopMargin?: string;
5
5
  }
@@ -0,0 +1,7 @@
1
+ export default class DocumentQualityAnalyzerConfiguration {
2
+ /**
3
+ * Patch size should be approx. 512-768. It governs the trade-off between speed and memory usage.
4
+ * Smaller patch sizes use less memory but take longer. Defaults to 512.
5
+ */
6
+ patchSize: number;
7
+ }
@@ -1,10 +1,12 @@
1
1
  import { TextDataScannerResult } from "../generic-text-line-recognizer/text-data-scanner-result";
2
2
  import { ScannerConfiguration } from "./scanner-configuration";
3
3
  import { ViewFinderConfiguration } from "./view-finder-configuration";
4
+ export declare type ValidatorPreset = "VehicleIdentificationNumber";
4
5
  export declare class TextDataScannerConfiguration extends ScannerConfiguration {
5
6
  constructor();
6
7
  ocrResolutionLimit?: number;
7
8
  supportedLanguages?: string[];
9
+ validatorPreset?: ValidatorPreset;
8
10
  style?: ViewFinderConfiguration;
9
11
  onTextDetected?: (e: TextDataScannerResult) => void;
10
12
  static fromJson(json: any): TextDataScannerConfiguration;
@@ -0,0 +1,8 @@
1
+ export declare type DocumentQuality = "NO_DOCUMENT" | "VERY_POOR" | "POOR" | "REASONABLE" | "GOOD" | "EXCELLENT";
2
+ export default interface DocumentQualityAnalyzerResult {
3
+ /**
4
+ * Result of document quality analysis.
5
+ * It is used to determine if the document is good enough to be used for OCR processing.
6
+ */
7
+ quality: DocumentQuality;
8
+ }
@@ -19,10 +19,11 @@ import { MrzScannerConfiguration } from "./model/configuration/mrz-scanner-confi
19
19
  import { IMrzScannerHandle } from "./interfaces/i-mrz-scanner-handle";
20
20
  import SimpleMrzRecognizer from "./service/simple-mrz-recognizer";
21
21
  import OcrEngine from "./service/ocr-engine";
22
- import BlurDetector from "./service/blur-detector";
23
22
  import { ContourDetectionResult } from "./model/document/contour-detection-result";
24
23
  import { TextDataScannerConfiguration } from "./model/configuration/text-data-scanner-configuration";
25
24
  import { ITextDataScannerHandle } from "./interfaces/i-text-data-scanner-handle";
25
+ import DocumentQualityAnalyzerConfiguration from "./model/configuration/document-quality-analyzer-configuration";
26
+ import DocumentQualityAnalyzer from "./service/document-quality-analyzer";
26
27
  export default class ScanbotSDK {
27
28
  bridge: WorkerBridge;
28
29
  initialized: boolean;
@@ -44,11 +45,12 @@ export default class ScanbotSDK {
44
45
  applyFilter(imageBuffer: ArrayBuffer, filterType: ImageFilter): Promise<ArrayBuffer>;
45
46
  rotateImageCcw(imageBuffer: ArrayBuffer, rotations: number): Promise<ArrayBuffer>;
46
47
  cropAndRotateImageCcw(imageBuffer: ArrayBuffer, polygon: Polygon, rotations: number): Promise<any>;
48
+ analyzeDocumentQuality(imageBuffer: ArrayBuffer, polygon: Polygon, rotations: number): Promise<any>;
47
49
  detectDocument(imageBuffer: ArrayBuffer, acceptedAngleScore?: number, acceptedSizeScore?: number): Promise<ContourDetectionResult>;
48
50
  detectBarcodes(base64: string, engineMode?: EngineMode, barcodeFormats?: BarcodeFormat[], returnBarcodeImage?: boolean): Promise<BarcodeResult>;
49
51
  createSimpleMRZRecognizer(): Promise<SimpleMrzRecognizer>;
50
52
  createOcrEngine(languages: Array<string>): Promise<OcrEngine>;
51
- createBlurDetector(): Promise<BlurDetector>;
53
+ createDocumentQualityAnalyzer(config?: DocumentQualityAnalyzerConfiguration): Promise<DocumentQualityAnalyzer>;
52
54
  /**
53
55
  * Misc. Features
54
56
  */
@@ -63,5 +65,6 @@ export default class ScanbotSDK {
63
65
  */
64
66
  throwIfMissingBuffer(buffer: any): void;
65
67
  throwIfMissing(property: any, message: string): void;
68
+ release(object: any, source?: string): Promise<void>;
66
69
  private licenseCheck;
67
70
  }
@@ -0,0 +1,9 @@
1
+ import ScanbotSDK from '../scanbot-sdk';
2
+ import DocumentQualityAnalyzerResult from '../model/response/document-quality-analyzer-result';
3
+ export default class DocumentQualityAnalyzer {
4
+ _token: string;
5
+ _sdk: ScanbotSDK;
6
+ constructor(sdk: ScanbotSDK, token: string);
7
+ analyze(imageData: ArrayBuffer): Promise<DocumentQualityAnalyzerResult>;
8
+ release(): Promise<void>;
9
+ }
@@ -1,21 +1,19 @@
1
1
  import ScanbotSDK from '../scanbot-sdk';
2
- /**
3
- * Paper size calculation:
4
- * - if a standard paper size is given, that paper size is used
5
- * - otherwise if both paperWidthInches and paperHeightInches is set, those values are used
6
- * - otherwise the paper size is calculated to fit the input image exactly at the given DPI. If no
7
- * DPI value is given, a default DPI of 72 is used.
8
- *
9
- * DPI calculation:
10
- * - if a DPI is given, then that value is used. If the value is not given or
11
- * that value is too small for the entire image to fit on the page, then
12
- * the smallest possible DPI value is chosen so that the entire image fits on the page.
13
- */
2
+ export declare type PageSize = "LETTER" | // 8.5 x 11 (inches) 612 x 792 (pixels)
3
+ "LEGAL" | // 8.5 x 14 (inches) 612 x 1008 (pixels)
4
+ "A3" | // 297 x 420 (mm) 841.89 x 1199.551 (pixels)
5
+ "A4" | // 210 x 297 (mm) 595.276 x 841.89 (pixels)
6
+ "A5" | // 148 x 210 (mm) 419.528 x 595.276 (pixels)
7
+ "B4" | // 250 x 353 (mm) 708.661 x 1000.63 (pixels)
8
+ "B5" | // 176 x 250 (mm) 498.898 x 708.661 (pixels)
9
+ "EXECUTIVE" | // 7.25 x 10.5 (inches) 522 x 756 (pixels)
10
+ "US4x6" | // 4 x 6 (inches) 288 x 432 (pixels)
11
+ "US4x8" | // 4 x 8 (inches) 288 x 576 (pixels)
12
+ "US5x7" | // 5 x 7 (inches) 360 x 504 (pixels)
13
+ "COMM10" | // 4.125 x 9.5 (inches) 297 x 684 (pixels)
14
+ "CUSTOM";
14
15
  export interface PdfGenerationOptions {
15
- dpi?: number;
16
- standardPaperSize?: 'A4' | 'Letter' | 'Legal';
17
- paperWidthInches?: number;
18
- paperHeightInches?: number;
16
+ standardPaperSize?: PageSize;
19
17
  landscape?: boolean;
20
18
  }
21
19
  export default class PdfGenerator {