@softvision/webpdf-wsclient-typescript
Version:
A simplified and optimized API client library for the webPDF server
196 lines • 9.88 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FreeTextAnnotation = void 0;
const index_1 = require("./../index");
class FreeTextAnnotation {
constructor(data) {
let colorDefault = "#4800FF";
this.color = typeof (data === null || data === void 0 ? void 0 : data.color) !== "undefined" ? data === null || data === void 0 ? void 0 : data.color : colorDefault;
let contentsDefault = "";
this.contents = typeof (data === null || data === void 0 ? void 0 : data.contents) !== "undefined" ? data === null || data === void 0 ? void 0 : data.contents : contentsDefault;
let creatorDefault = "";
this.creator = typeof (data === null || data === void 0 ? void 0 : data.creator) !== "undefined" ? data === null || data === void 0 ? void 0 : data.creator : creatorDefault;
this.font = index_1.FreeTextFont.fromJson(data === null || data === void 0 ? void 0 : data.font);
let hiddenDefault = false;
this.hidden = typeof (data === null || data === void 0 ? void 0 : data.hidden) !== "undefined" ? data === null || data === void 0 ? void 0 : data.hidden : hiddenDefault;
let intentsDefault = "";
this.intents = typeof (data === null || data === void 0 ? void 0 : data.intents) !== "undefined" ? data === null || data === void 0 ? void 0 : data.intents : intentsDefault;
let invisibleDefault = false;
this.invisible = typeof (data === null || data === void 0 ? void 0 : data.invisible) !== "undefined" ? data === null || data === void 0 ? void 0 : data.invisible : invisibleDefault;
let justificationDefault = "leftJustified";
this.justification = typeof (data === null || data === void 0 ? void 0 : data.justification) !== "undefined" ? data === null || data === void 0 ? void 0 : data.justification : justificationDefault;
let lockedDefault = true;
this.locked = typeof (data === null || data === void 0 ? void 0 : data.locked) !== "undefined" ? data === null || data === void 0 ? void 0 : data.locked : lockedDefault;
let nameDefault = "";
this.name = typeof (data === null || data === void 0 ? void 0 : data.name) !== "undefined" ? data === null || data === void 0 ? void 0 : data.name : nameDefault;
let opacityDefault = 100;
this.opacity = typeof (data === null || data === void 0 ? void 0 : data.opacity) !== "undefined" ? data === null || data === void 0 ? void 0 : data.opacity : opacityDefault;
let pageDefault = 1;
this.page = typeof (data === null || data === void 0 ? void 0 : data.page) !== "undefined" ? data === null || data === void 0 ? void 0 : data.page : pageDefault;
this.position = index_1.PositionFreeTextAnnotation.fromJson(data === null || data === void 0 ? void 0 : data.position);
let printableDefault = false;
this.printable = typeof (data === null || data === void 0 ? void 0 : data.printable) !== "undefined" ? data === null || data === void 0 ? void 0 : data.printable : printableDefault;
let rotatableDefault = true;
this.rotatable = typeof (data === null || data === void 0 ? void 0 : data.rotatable) !== "undefined" ? data === null || data === void 0 ? void 0 : data.rotatable : rotatableDefault;
let subjectDefault = "";
this.subject = typeof (data === null || data === void 0 ? void 0 : data.subject) !== "undefined" ? data === null || data === void 0 ? void 0 : data.subject : subjectDefault;
let viewableDefault = true;
this.viewable = typeof (data === null || data === void 0 ? void 0 : data.viewable) !== "undefined" ? data === null || data === void 0 ? void 0 : data.viewable : viewableDefault;
let writableDefault = true;
this.writable = typeof (data === null || data === void 0 ? void 0 : data.writable) !== "undefined" ? data === null || data === void 0 ? void 0 : data.writable : writableDefault;
let zoomableDefault = true;
this.zoomable = typeof (data === null || data === void 0 ? void 0 : data.zoomable) !== "undefined" ? data === null || data === void 0 ? void 0 : data.zoomable : zoomableDefault;
}
static getColorDefault() {
return "#4800FF";
}
static getColorDescription() {
return "The annotation color will change the main color of visible annotations. The color needs to be specified as a hexadecimal RGB value with a number sign before it.";
}
static getContentsDefault() {
return "";
}
static getContentsDescription() {
return "This value is used to configure the text content of the annotation, with the way in which it is displayed depending heavily on the specific annotation type (for example, in the case of a text note, this would be the text content of the annotation's popup).";
}
static getCreatorDefault() {
return "";
}
static getCreatorDescription() {
return "Used to specify the author of the annotation.";
}
static getFontDescription() {
return "";
}
static getHiddenDefault() {
return false;
}
static getHiddenDescription() {
return "If this value is set to true, the annotation will not be shown on the page and will not be printed either.";
}
static getIntentsDefault() {
return "";
}
static getIntentsDescription() {
return "Used to set the intention of the annotation.\n\n**Important:** The intention of an annotation can directly influence it's behaviour and may serve different purposes for different annotation types. Only set this directly, if you know it is necessary and possible to do so.";
}
static getInvisibleDefault() {
return false;
}
static getInvisibleDescription() {
return "If this value is set to true, the annotation will be visible on the page only when printed, and provided it is a PDF standard annotation.";
}
static getJustificationDefault() {
return "leftJustified";
}
static getJustificationDescription() {
return "Selects the horizontal justification\/alignment\/orientation of elements.\n\n* leftJustified = All elements shall be oriented to the left.\n* centered = All elements shall be placed in the center of the container.\n* rightJustified = All elements shall be oriented to the right.";
}
static getLockedDefault() {
return true;
}
static getLockedDescription() {
return "If this value is set to true, the annotation will be locked so that no changes can be made to it.";
}
static getNameDefault() {
return "";
}
static getNameDescription() {
return "Used to specify the name of the annotation.";
}
static getOpacityDefault() {
return 100;
}
static getOpacityDescription() {
return "This percentage value is used to set the annotation's transparency.";
}
static getOpacityMin() {
return 0;
}
static getOpacityMax() {
return 100;
}
static getPageDefault() {
return 1;
}
static getPageDescription() {
return "Set the number of the page, the annotation shall be placed on.";
}
static getPageMin() {
return 1;
}
static getPositionDescription() {
return "";
}
static getPrintableDefault() {
return false;
}
static getPrintableDescription() {
return "If this value is set to true, the annotation will be included when the page is printed out.";
}
static getRotatableDefault() {
return true;
}
static getRotatableDescription() {
return "If this value is set to true, the annotation shall be rotatable according to the displayed page rotation.";
}
static getSubjectDefault() {
return "";
}
static getSubjectDescription() {
return "Used to specify the subject of the annotation.";
}
static getViewableDefault() {
return true;
}
static getViewableDescription() {
return "If this value is set to true, the annotation will be shown on the document's page.";
}
static getWritableDefault() {
return true;
}
static getWritableDescription() {
return "If this value is set to true, it will be possible to change the annotation's contents later on.";
}
static getZoomableDefault() {
return true;
}
static getZoomableDescription() {
return "If this value is set to true, the annotation will adjust its own zoom factor as required for the page in order to always be clearly readable \/ recognizable.";
}
static fromJson(data) {
if (data === undefined || data === null) {
return data;
}
return new FreeTextAnnotation(data);
}
toJson() {
var _a, _b;
return {
'color': this.color,
'contents': this.contents,
'creator': this.creator,
'font': (_a = this.font) === null || _a === void 0 ? void 0 : _a.toJson(),
'hidden': this.hidden,
'intents': this.intents,
'invisible': this.invisible,
'justification': this.justification,
'locked': this.locked,
'name': this.name,
'opacity': this.opacity,
'page': this.page,
'position': (_b = this.position) === null || _b === void 0 ? void 0 : _b.toJson(),
'printable': this.printable,
'rotatable': this.rotatable,
'subject': this.subject,
'viewable': this.viewable,
'writable': this.writable,
'zoomable': this.zoomable,
};
}
clone() {
return FreeTextAnnotation.fromJson(this.toJson());
}
}
exports.FreeTextAnnotation = FreeTextAnnotation;
//# sourceMappingURL=FreeTextAnnotation.js.map