UNPKG

@softvision/webpdf-wsclient-typescript

Version:

A simplified and optimized API client library for the webPDF server

223 lines 13.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TextAnnotation = void 0; const index_1 = require("./../index"); class TextAnnotation { constructor(data) { let appearanceGenerationDefault = "nonStandard"; this.appearanceGeneration = typeof (data === null || data === void 0 ? void 0 : data.appearanceGeneration) !== "undefined" ? data === null || data === void 0 ? void 0 : data.appearanceGeneration : appearanceGenerationDefault; 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; let customIconNameDefault = ""; this.customIconName = typeof (data === null || data === void 0 ? void 0 : data.customIconName) !== "undefined" ? data === null || data === void 0 ? void 0 : data.customIconName : customIconNameDefault; 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 iconDefault = "note"; this.icon = typeof (data === null || data === void 0 ? void 0 : data.icon) !== "undefined" ? data === null || data === void 0 ? void 0 : data.icon : iconDefault; let initialOpenDefault = true; this.initialOpen = typeof (data === null || data === void 0 ? void 0 : data.initialOpen) !== "undefined" ? data === null || data === void 0 ? void 0 : data.initialOpen : initialOpenDefault; 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 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; this.normalAppearance = index_1.AppearanceSource.fromJson(data === null || data === void 0 ? void 0 : data.normalAppearance); 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.Rectangle.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 getAppearanceGenerationDefault() { return "nonStandard"; } static getAppearanceGenerationDescription() { return "Determines for which named annotations appearance streams shall be generated.\n\n**Important:** Per definition some named annotations are defined as standard names and PDF readers shall provide the means to draw those.\n\n* always = An appearance stream shall be prepared for all created named annotations.\n* never = Don't provide appearance streams and rely on PDF readers to dynamically generate a proper representation of named annotations.\n* nonStandard = Only provide appearance streams for non-standard annotations."; } 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 getCustomIconNameDefault() { return ""; } static getCustomIconNameDescription() { return "Sets a custom icon name for this annotation.\n\n**Important:** This name shall always take precedence over possibly set standard names. (icon)"; } 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 getIconDefault() { return "note"; } static getIconDescription() { return "Used to specify the icon that should be displayed for the note on the page. The following values are available:\n\n* check = The text annotation approves the content.\n* checkmark = The text annotation adds a gray checkmark to the content.\n* circle = The text annotation is a comment on the circled content.\n* comment = The text annotation is a comment to the marked contents.\n* cross = The text annotation marks the content or crosses it out.\n* crossHair = The text annotation targets the content in the crosshair.\n* insert = The text annotation is suggesting inserting some content.\n* key = The text annotation marks or contains a key content\/information.\n* note = The text annotation is a mere note concerning the marked content.\n* help = The text annotation provides helpful information concerning the marked content.\n* newParagraph = The text annotation suggests adding a new Paragraph at a specific point.\n* paragraph = The text annotation is concerning the whole paragraph.\n* rightArrow = The text annotation is concerning the content to the right.\n* rightPointer = The text annotation is concerning the content to the right.\n* star = The text annotation marks content as especially important.\n* upArrow = The text annotation is concerning the content at the top.\n* upLeftArrow = The text annotation is concerning the content at the top left.\n* unnamed = The text annotation shall not provide a predefined name."; } static getInitialOpenDefault() { return true; } static getInitialOpenDescription() { return "If this value is set to \"true,\" the popup for the corresponding \"note\" annotation will be opened as soon as the corresponding document page is viewed."; } 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 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 getNormalAppearanceDescription() { return ""; } 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 TextAnnotation(data); } toJson() { var _a, _b; return { 'appearanceGeneration': this.appearanceGeneration, 'color': this.color, 'contents': this.contents, 'creator': this.creator, 'customIconName': this.customIconName, 'hidden': this.hidden, 'icon': this.icon, 'initialOpen': this.initialOpen, 'intents': this.intents, 'invisible': this.invisible, 'locked': this.locked, 'name': this.name, 'normalAppearance': (_a = this.normalAppearance) === null || _a === void 0 ? void 0 : _a.toJson(), '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 TextAnnotation.fromJson(this.toJson()); } } exports.TextAnnotation = TextAnnotation; //# sourceMappingURL=TextAnnotation.js.map