UNPKG

@softvision/webpdf-wsclient-typescript

Version:

A simplified and optimized API client library for the webPDF server

116 lines 5.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FileAnnotation = void 0; const index_1 = require("./../index"); class FileAnnotation { 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 heightDefault = 0; this.height = typeof (data === null || data === void 0 ? void 0 : data.height) !== "undefined" ? data === null || data === void 0 ? void 0 : data.height : heightDefault; let iconDefault = "paperclip"; this.icon = typeof (data === null || data === void 0 ? void 0 : data.icon) !== "undefined" ? data === null || data === void 0 ? void 0 : data.icon : iconDefault; let lockedPositionDefault = true; this.lockedPosition = typeof (data === null || data === void 0 ? void 0 : data.lockedPosition) !== "undefined" ? data === null || data === void 0 ? void 0 : data.lockedPosition : lockedPositionDefault; 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.point = index_1.Point.fromJson(data.point); let popupTextDefault = ""; this.popupText = typeof (data === null || data === void 0 ? void 0 : data.popupText) !== "undefined" ? data === null || data === void 0 ? void 0 : data.popupText : popupTextDefault; let widthDefault = 0; this.width = typeof (data === null || data === void 0 ? void 0 : data.width) !== "undefined" ? data === null || data === void 0 ? void 0 : data.width : widthDefault; } static getColorDefault() { return "#4800FF"; } static getColorDescription() { return "The annotation colour will change the main colour of the attachment's icon. The colour needs to be specified as a hexadecimal RGB value with a number sign before it."; } static getHeightDefault() { return 0; } static getHeightDescription() { return "If this value is positive, the annotation will be generated with a fixed height corresponding to the value instead of using the dimensions of the specified icon."; } static getHeightMin() { return 0; } static getIconDefault() { return "paperclip"; } static getIconDescription() { return "If an attachment is embedded at the page level, this option can be used to specify the icon that should be used to show it:\n\nThe value you use here will define which icon will be used, as well as the basic dimensions for the annotation generated in the PDF. If you use the \"None\" icon type, a predefined icon will not be used. Instead, this option will only use the dimensions specified in \"width\" and \"height\" to generate an annotation with a transparent selection box at the specified position.\n\n* graph = Diagram\n* paperclip = Paper clip\n* pushPin = Thumb tack\n* tag = Tag\n* none = Rectangular selection box"; } static getLockedPositionDefault() { return true; } static getLockedPositionDescription() { return "If this value is set to \"true\", the person viewing the document will not be allowed to move the icon for the file attached at the page level."; } static getOpacityDefault() { return 100; } static getOpacityDescription() { return "Used to set the opacity for the attachment's icon. A percent value between 0 and 100 is allowed, whereby 0 equals the minimum opacity. The higher the value, the more the content of the PDF document will be covered over."; } static getOpacityMin() { return 0; } static getOpacityMax() { return 100; } static getPageDefault() { return 1; } static getPageDescription() { return "Used to define the page on which the annotation will be generated, i.e., the page where the attachment will be stored."; } static getPageMin() { return 1; } static getPointDescription() { return ""; } static getPopupTextDefault() { return ""; } static getPopupTextDescription() { return "The text that should be displayed in the pop-up for the annotation."; } static getWidthDefault() { return 0; } static getWidthDescription() { return "If this value is positive, the annotation will be generated with a fixed width corresponding to the value instead of using the dimensions of the specified icon."; } static getWidthMin() { return 0; } static fromJson(data) { if (data === undefined || data === null) { return data; } return new FileAnnotation(data); } toJson() { var _a; return { 'color': this.color, 'height': this.height, 'icon': this.icon, 'lockedPosition': this.lockedPosition, 'opacity': this.opacity, 'page': this.page, 'point': (_a = this.point) === null || _a === void 0 ? void 0 : _a.toJson(), 'popupText': this.popupText, 'width': this.width, }; } clone() { return FileAnnotation.fromJson(this.toJson()); } } exports.FileAnnotation = FileAnnotation; //# sourceMappingURL=FileAnnotation.js.map