@softvision/webpdf-wsclient-typescript
Version:
A simplified and optimized API client library for the webPDF server
85 lines • 4.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextHighlight = void 0;
class TextHighlight {
constructor(data) {
let colorDefault = "#000000";
this.color = typeof (data === null || data === void 0 ? void 0 : data.color) !== "undefined" ? data === null || data === void 0 ? void 0 : data.color : colorDefault;
let fontFamilyDefault = "";
this.fontFamily = typeof (data === null || data === void 0 ? void 0 : data.fontFamily) !== "undefined" ? data === null || data === void 0 ? void 0 : data.fontFamily : fontFamilyDefault;
let fontOriginDefault = "system";
this.fontOrigin = typeof (data === null || data === void 0 ? void 0 : data.fontOrigin) !== "undefined" ? data === null || data === void 0 ? void 0 : data.fontOrigin : fontOriginDefault;
let fontSizeDefault = "10px";
this.fontSize = typeof (data === null || data === void 0 ? void 0 : data.fontSize) !== "undefined" ? data === null || data === void 0 ? void 0 : data.fontSize : fontSizeDefault;
let lineHeightDefault = "12px";
this.lineHeight = typeof (data === null || data === void 0 ? void 0 : data.lineHeight) !== "undefined" ? data === null || data === void 0 ? void 0 : data.lineHeight : lineHeightDefault;
let lineNumbersDefault = false;
this.lineNumbers = typeof (data === null || data === void 0 ? void 0 : data.lineNumbers) !== "undefined" ? data === null || data === void 0 ? void 0 : data.lineNumbers : lineNumbersDefault;
let wordBreakDefault = "auto";
this.wordBreak = typeof (data === null || data === void 0 ? void 0 : data.wordBreak) !== "undefined" ? data === null || data === void 0 ? void 0 : data.wordBreak : wordBreakDefault;
}
static getColorDefault() {
return "#000000";
}
static getColorDescription() {
return "Sets the font color for the text to the given value. The colour needs to be specified as a hexadecimal RGB value with a number sign before it.";
}
static getFontFamilyDefault() {
return "";
}
static getFontFamilyDescription() {
return "Specifies the font to use for the text. If you select \"folder\" for the \"fontOrigin\" parameter, the font here needs to be specified with the filename for the file. Otherwise, use the name of the font you want. If the value is left blank, the \"SourceHanSans\" font will be used automatically.";
}
static getFontOriginDefault() {
return "system";
}
static getFontOriginDescription() {
return "Used to specify whether the selected font should be obtained from your operating system or from the \"templates\/fonts\" folder (in your webPDF installation path). Possible values:\n\n* system = It will be possible to select from the fonts available system-wide.\n* folder =It will be possible to select from the fonts in \"templates\/fonts\".";
}
static getFontSizeDefault() {
return "10px";
}
static getFontSizeDescription() {
return "Used to set the font size for the text to the specified value. You can use any of the following units:\n\n* px = Pixels\n* cm = Centimeters\n* mm = Millimeters\n* in = Inches\n* pt = Points\n* pc = Pica";
}
static getLineHeightDefault() {
return "12px";
}
static getLineHeightDescription() {
return "Used to set the line height. You can use any of the following units:\n\n* px = Pixels\n* cm = Centimeters\n* mm = Millimeters\n* in = Inches\n* pt = Points\n* pc = Pica";
}
static getLineNumbersDefault() {
return false;
}
static getLineNumbersDescription() {
return "If this value is set to \"true\", line numbers are added before the code.";
}
static getWordBreakDefault() {
return "auto";
}
static getWordBreakDescription() {
return "Can be used to configure the word wrap behaviour during highlighting Possible values:\n\n* auto = Automatic word wrap if necessary.\n* none = Suppress the addition of extra line breaks.\n* word = Line breaks allowed only after words.\n* all = Line breaks allowed unconditionally.";
}
static fromJson(data) {
if (data === undefined || data === null) {
return data;
}
return new TextHighlight(data);
}
toJson() {
return {
'color': this.color,
'fontFamily': this.fontFamily,
'fontOrigin': this.fontOrigin,
'fontSize': this.fontSize,
'lineHeight': this.lineHeight,
'lineNumbers': this.lineNumbers,
'wordBreak': this.wordBreak,
};
}
clone() {
return TextHighlight.fromJson(this.toJson());
}
}
exports.TextHighlight = TextHighlight;
//# sourceMappingURL=TextHighlight.js.map