@softvision/webpdf-wsclient-typescript
Version:
A simplified and optimized API client library for the webPDF server
131 lines • 7.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BarcodeSelection = void 0;
const index_1 = require("./../index");
class BarcodeSelection {
constructor(data) {
let allowedLengthsDefault = "";
this.allowedLengths = typeof (data === null || data === void 0 ? void 0 : data.allowedLengths) !== "undefined" ? data === null || data === void 0 ? void 0 : data.allowedLengths : allowedLengthsDefault;
let barcode39CheckDigitDefault = false;
this.barcode39CheckDigit = typeof (data === null || data === void 0 ? void 0 : data.barcode39CheckDigit) !== "undefined" ? data === null || data === void 0 ? void 0 : data.barcode39CheckDigit : barcode39CheckDigitDefault;
let charsetDefault = "utf-8";
this.charset = typeof (data === null || data === void 0 ? void 0 : data.charset) !== "undefined" ? data === null || data === void 0 ? void 0 : data.charset : charsetDefault;
let codabarStartEndDigitsDefault = false;
this.codabarStartEndDigits = typeof (data === null || data === void 0 ? void 0 : data.codabarStartEndDigits) !== "undefined" ? data === null || data === void 0 ? void 0 : data.codabarStartEndDigits : codabarStartEndDigitsDefault;
let formatsDefault = "";
this.formats = typeof data.formats !== "undefined" ? data.formats : formatsDefault;
let gs1Default = false;
this.gs1 = typeof (data === null || data === void 0 ? void 0 : data.gs1) !== "undefined" ? data === null || data === void 0 ? void 0 : data.gs1 : gs1Default;
let pagesDefault = "";
this.pages = typeof (data === null || data === void 0 ? void 0 : data.pages) !== "undefined" ? data === null || data === void 0 ? void 0 : data.pages : pagesDefault;
let pureBarcodeDefault = false;
this.pureBarcode = typeof (data === null || data === void 0 ? void 0 : data.pureBarcode) !== "undefined" ? data === null || data === void 0 ? void 0 : data.pureBarcode : pureBarcodeDefault;
let resolutionDefault = 200;
this.resolution = typeof (data === null || data === void 0 ? void 0 : data.resolution) !== "undefined" ? data === null || data === void 0 ? void 0 : data.resolution : resolutionDefault;
this.scanArea = index_1.Rectangle.fromJson(data === null || data === void 0 ? void 0 : data.scanArea);
let tryHarderDefault = true;
this.tryHarder = typeof (data === null || data === void 0 ? void 0 : data.tryHarder) !== "undefined" ? data === null || data === void 0 ? void 0 : data.tryHarder : tryHarderDefault;
let upcEanExtensionsDefault = "";
this.upcEanExtensions = typeof (data === null || data === void 0 ? void 0 : data.upcEanExtensions) !== "undefined" ? data === null || data === void 0 ? void 0 : data.upcEanExtensions : upcEanExtensionsDefault;
}
static getAllowedLengthsDefault() {
return "";
}
static getAllowedLengthsDescription() {
return "If this value is set, it will limit the allowed lengths for encoded values. In other words, barcodes with a length that is not listed will be ignored. (Example: \"13,8,25\")";
}
static getBarcode39CheckDigitDefault() {
return false;
}
static getBarcode39CheckDigitDescription() {
return "If this value is set to \"true\", the system will assume that all recognized Code 39 barcodes contain a correct check digit.";
}
static getCharsetDefault() {
return "utf-8";
}
static getCharsetDescription() {
return "Used to specify the character set in which the barcode contents are stored.";
}
static getCodabarStartEndDigitsDefault() {
return false;
}
static getCodabarStartEndDigitsDescription() {
return "If this value is set to \"true\", the start and stop symbols of recognized Codabar barcodes will be read instead of removed during recognition.";
}
static getFormatsDefault() {
return "";
}
static getFormatsDescription() {
return "Used to define the list of barcodes (comma-separated) that should be searched for. There must be at least one barcode format here; otherwise, no search will be run. The names are the same as those used in `<add>`, i.e., the following are the barcode names available:\n\n* qrcode\n* aztec\n* codabar\n* code128\n* code39\n* datamatrix\n* ean13\n* ean8\n* itf\n* pdf417\n* upca";
}
static getGs1Default() {
return false;
}
static getGs1Description() {
return "If this value is set to \"true\", the system will assume that all recognized barcodes are GS1-compliant barcodes, and the way all processes behave and work will be adjusted accordingly (for instance, the way in which the FNC1 character is handled for Code 128)";
}
static getPagesDefault() {
return "";
}
static getPagesDescription() {
return "The page range within which barcodes should be scanned. Individual pages or a range of pages can be defined here. If the text is empty, the entire file will be exported (e.g.: \"1-10\" or \"1,2,5-10\")";
}
static getPureBarcodeDefault() {
return false;
}
static getPureBarcodeDescription() {
return "If this value is set to \"true\", the system will assume that the source document being scanned (limited by `<scanArea>`) does not contain any elements other than the barcode. This option can speed up the recognition process significantly. If, however, this option is enabled and there are elements other than a barcode, recognition may fail completely.";
}
static getResolutionDefault() {
return 200;
}
static getResolutionDescription() {
return "Used to select the resolution for the recognition operation. Depending on the barcode's format and quality, higher or lower values may yield better results (in any case, higher values will slow down processing).";
}
static getResolutionMin() {
return 1;
}
static getScanAreaDescription() {
return "";
}
static getTryHarderDefault() {
return true;
}
static getTryHarderDescription() {
return "If this value is set to \"true\", more computing time will be invested in order to guarantee successful recognition. For example, the system will also scan for barcodes along the vertical axis.";
}
static getUpcEanExtensionsDefault() {
return "";
}
static getUpcEanExtensionsDescription() {
return "If this value is set, it will limit the allowed lengths for encoded EAN and UPC Extensions. In other words, barcodes with an Extension length that is not listed will be ignored. (Example: \"2,5\")";
}
static fromJson(data) {
if (data === undefined || data === null) {
return data;
}
return new BarcodeSelection(data);
}
toJson() {
var _a;
return {
'allowedLengths': this.allowedLengths,
'barcode39CheckDigit': this.barcode39CheckDigit,
'charset': this.charset,
'codabarStartEndDigits': this.codabarStartEndDigits,
'formats': this.formats,
'gs1': this.gs1,
'pages': this.pages,
'pureBarcode': this.pureBarcode,
'resolution': this.resolution,
'scanArea': (_a = this.scanArea) === null || _a === void 0 ? void 0 : _a.toJson(),
'tryHarder': this.tryHarder,
'upcEanExtensions': this.upcEanExtensions,
};
}
clone() {
return BarcodeSelection.fromJson(this.toJson());
}
}
exports.BarcodeSelection = BarcodeSelection;
//# sourceMappingURL=BarcodeSelection.js.map