react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
166 lines (155 loc) • 6.81 kB
TypeScript
import { BarcodeFormatConfigurationBase } from '../barcode/BarcodeConfigurationTypes';
import { BarcodeDocumentFormat } from '../barcode/BarcodeDocumentTypes';
import { BarcodeFormat } from '../barcode/BarcodeTypes';
import { GenericDocument } from '../documents/GenericDocument';
import { ImageRef } from '../imageRef/image';
import { ToJsonConfiguration } from '../utils/json/JsonSerializationTypes';
import { DeepPartial, PartiallyConstructible, Point } from '../utils/utils';
/**
A single barcode found in the input image. Barcodes with the same content but different locations in the image are considered separate barcodes.
*/
export declare class BarcodeItem extends PartiallyConstructible {
/**
Text contained in the barcode. Binary data is returned in the rawBytes field only.
*/
readonly text: string;
/**
Barcode format.
Default is NONE
*/
readonly format: BarcodeFormat;
/**
The four corners of the barcode in the input image, in clockwise order starting from the top left, in image coordinates.
*/
readonly quad: Point[];
/**
The four corners of the barcode in the input image, in clockwise order starting from the top left, normalized to the range [0, 1].
*/
readonly quadNormalized: Point[];
/**
True if this is a 1D barcode that is printed upside-down, that is, the barcode was scanned right-to-left.
Default is false
*/
readonly isUpsideDown: boolean;
/**
A crop from the input image containing the barcode.
*/
readonly sourceImage: ImageRef | null;
/**
Raw bytes of barcode contents. Some formats can contain binary data, which is returned in this field.
*/
readonly rawBytes: string;
/**
If this is a UPC/EAN barcode that has an EAN-2 or EAN-5 extension, this field contains the extension value. Requires the UPC_EAN_EXTENSION format to be enabled in the decoding options.
*/
readonly upcEanExtension: string;
/**
True if the barcode contains a GS1 message. Requires GS1 handling to be enabled in the decoding option.
Default is false
*/
readonly isGS1Message: boolean;
/**
True if this result is the 2D part of a GS1 Composite barcode.
Can only happen if GS1_COMPOSITE scanning is disabled and a part of the composite (1D) or (2D) is scanned separately.
When GS1_COMPOSITE scanning is enabled, parts of the composite barcode are never returned separately, even if their respective
format is enabled in the decoding options.
Default is false
*/
readonly isGS1CompositePart: boolean;
/**
The number of 1D stacks in the barcode. Applies only to DATABAR and DATABAR_EXPANDED barcodes.
Default is 1
*/
readonly dataBarStackSize: number;
/**
The size score is a floating point value between 0 and 1 that represents the relative size of the barcode in the input image.
Barcodes taking up a small portion of the input image will have a score close to 0, while barcodes that take a large portion will have a score close to 1.
Default is 0
*/
readonly sizeScore: number;
/**
The parsed known document format (if parsed successfully).
*/
readonly extractedDocument: GenericDocument | null;
/** @param source {@displayType `DeepPartial<BarcodeItem>`} */
constructor(source?: DeepPartial<BarcodeItem>);
serialize(config?: ToJsonConfiguration): Promise<DeepPartial<BarcodeItem>>;
private _released;
release(): void;
encodeImages(): Promise<void>;
}
/**
The engine mode for barcode scanning.
- `LEGACY`:
Legacy mode. Very fast, significantly less accurate. Doesn't support all barcode types.
- `NEXT_GEN_LOW_POWER`:
A faster version of the main engine mode, for use with low-power devices.
- `NEXT_GEN`:
Main engine mode for high-power devices. Supports all barcodes types.
- `NEXT_GEN_LOW_POWER_FAR_DISTANCE`:
Similar to NEXT_GEN_LOW_POWER, but optimized for scanning from far distances.
- `NEXT_GEN_FAR_DISTANCE`:
Similar to NEXT_GEN, optimized for scanning from far distances.
*/
export type BarcodeScannerEngineMode = 'LEGACY' | 'NEXT_GEN_LOW_POWER' | 'NEXT_GEN' | 'NEXT_GEN_LOW_POWER_FAR_DISTANCE' | 'NEXT_GEN_FAR_DISTANCE';
export declare const BarcodeScannerEngineModeValues: BarcodeScannerEngineMode[];
/**
Configuration for the barcode scanner.
*/
export declare class BarcodeScannerConfiguration extends PartiallyConstructible {
/**
Options for barcode decoding.
*/
barcodeFormatConfigurations: BarcodeFormatConfigurationBase[];
/**
List of document formats to be extracted.
Barcodes that decode to one of the extracted document formats will have extractedDocument field in BarcodeItem populated with the parsed document.
By default all supported barcode document formats are accepted.
If empty, no barcodes will be parsed into documents.
To only accept the document formats listed in extractedDocumentFormats, the property onlyAcceptDocuments must be true.
*/
extractedDocumentFormats: BarcodeDocumentFormat[];
/**
If true and extractedDocumentFormats is not empty, then barcodes that don't decode to one of the extracted document formats will be ignored.
Default is false
*/
onlyAcceptDocuments: boolean;
/**
If true, the barcode image will be returned in the BarcodeItem.
Default is false
*/
returnBarcodeImage: boolean;
/**
The engine mode for barcode scanning.
Default is NEXT_GEN
*/
engineMode: BarcodeScannerEngineMode;
/**
If true, the quads of linear (1D) barcodes will be further refined to more closely match the barcode's outline in the input image.
This will also produce stabler barcode outlines across frames for use cases such as AR.
Default is false
*/
optimizedForOverlays: boolean;
/** @param source {@displayType `DeepPartial<BarcodeScannerConfiguration>`} */
constructor(source?: DeepPartial<BarcodeScannerConfiguration>);
}
/**
The result of barcode scanning.
*/
export declare class BarcodeScannerResult extends PartiallyConstructible {
/**
List of found barcodes.
*/
readonly barcodes: BarcodeItem[];
/**
True if any barcodes were found.
*/
readonly success: boolean;
/** @param source {@displayType `DeepPartial<BarcodeScannerResult>`} */
constructor(source?: DeepPartial<BarcodeScannerResult>);
serialize(config?: ToJsonConfiguration): Promise<DeepPartial<BarcodeScannerResult>>;
private _released;
release(): void;
encodeImages(): Promise<void>;
}
//# sourceMappingURL=BarcodeScannerTypes.d.ts.map