capacitor-plugin-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK for Capacitor
192 lines (186 loc) • 6.17 kB
JavaScript
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from core/schemas/TIFFTypes.yaml
import { ParametricFilter } from '../image_filters/ParametricFilters';
import { PartiallyConstructible } from '../utils/utils';
export const CompressionModeValues = [
'NONE',
'CCITTRLE',
'CCITT_T4',
'CCITT_T6',
'LZW',
'JPEG',
'CCITTRLEW',
'PACKBITS',
'DEFLATE',
'ADOBE_DEFLATE',
];
export const BinarizationValues = ['DISABLED', 'ENABLED', 'ENABLED_IF_BINARIZATION_FILTER_SET'];
/** @internal */
export var UserFieldValue;
(function (UserFieldValue) {
/** @internal */
function From(source) {
const _type = source['_type'];
switch (_type) {
case 'UserFieldDoubleValue':
return new UserFieldDoubleValue(source);
case 'UserFieldStringValue':
return new UserFieldStringValue(source);
case 'UserFieldIntValue':
return new UserFieldIntValue(source);
default:
throw `Unknown child class name: ${_type}`;
}
}
UserFieldValue.From = From;
})(UserFieldValue || (UserFieldValue = {}));
/**
Double value (TIFF_DOUBLE).
*/
export class UserFieldDoubleValue extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<UserFieldDoubleValue>`} */
constructor(source = {}) {
super();
this._type = 'UserFieldDoubleValue';
if (source.value !== undefined) {
this.value = source.value;
}
else {
throw new Error('value must be present in constructor argument');
}
}
}
/**
ASCII string value (TIFF_ASCII).
*/
export class UserFieldStringValue extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<UserFieldStringValue>`} */
constructor(source = {}) {
super();
this._type = 'UserFieldStringValue';
if (source.value !== undefined) {
this.value = source.value;
}
else {
throw new Error('value must be present in constructor argument');
}
}
}
/**
32-bit int value (TIFF_LONG).
*/
export class UserFieldIntValue extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<UserFieldIntValue>`} */
constructor(source = {}) {
super();
this._type = 'UserFieldIntValue';
if (source.value !== undefined) {
this.value = source.value;
}
else {
throw new Error('value must be present in constructor argument');
}
}
}
/**
User-defined TIFF field.
*/
export class UserField extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<UserField>`} */
constructor(source = {}) {
super();
if (source.tag !== undefined) {
this.tag = source.tag;
}
else {
throw new Error('tag must be present in constructor argument');
}
if (source.name !== undefined) {
this.name = source.name;
}
else {
throw new Error('name must be present in constructor argument');
}
if (source.value !== undefined) {
this.value = UserFieldValue.From(source.value);
}
else {
throw new Error('value must be present in constructor argument');
}
}
}
/**
TIFF generator parameters.
*/
export class TiffGeneratorParameters extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<TiffGeneratorParameters>`} */
constructor(source = {}) {
super();
/**
Compression.
Default is LZW
*/
this.compression = 'LZW';
/**
JPEG quality (TIFFTAG_JPEGQUALITY). Values range from 0 to 100.
Default is 80
*/
this.jpegQuality = 80;
/**
ZIP/Deflate compression level (TIFFTAG_ZIPQUALITY). Values range from 1 to 9.
Default is 6
*/
this.zipCompressionLevel = 6;
/**
DPI value.
Default is 72
*/
this.dpi = 72;
/**
User-defined fields.
*/
this.userFields = [];
/**
Filter to apply to the input image when adding pages with binarization.
If set, the filter is applied to the input image and the resulting image is stored as a 1-bit TIFF.
When storing documents it's typically best to use the BINARY_DOCUMENT_OPTIMIZED_COMPRESSION compression mode (CCITT_T6)
instead of the default, as it tends to produce the smallest file sizes.
If not set, simple thresholding is applied to the image, instead.
*/
this.binarizationFilter = null;
if (source.compression !== undefined) {
this.compression = source.compression;
}
if (source.jpegQuality !== undefined) {
this.jpegQuality = source.jpegQuality;
}
if (source.zipCompressionLevel !== undefined) {
this.zipCompressionLevel = source.zipCompressionLevel;
}
if (source.dpi !== undefined) {
this.dpi = source.dpi;
}
if (source.userFields !== undefined) {
this.userFields = source.userFields.map((it) => {
return new UserField(it);
});
}
if (source.binarizationFilter !== undefined) {
this.binarizationFilter =
source.binarizationFilter != null ? ParametricFilter.From(source.binarizationFilter) : null;
}
}
}
(function (TiffGeneratorParameters) {
/**
Default compression.
Default is LZW
*/
TiffGeneratorParameters.defaultCompression = 'LZW';
/**
Compression mode typically producing the smallest file sizes for binary (1-bit) document images.
Default is CCITT_T6
*/
TiffGeneratorParameters.binaryDocumentOptimizedCompression = 'CCITT_T6';
})(TiffGeneratorParameters || (TiffGeneratorParameters = {}));
//# sourceMappingURL=TiffTypes.js.map