UNPKG

@softvision/webpdf-wsclient-typescript

Version:

A simplified and optimized API client library for the webPDF server

103 lines 5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Svg = void 0; class Svg { constructor(data) { let decimalPrecisionDefault = 2; this.decimalPrecision = typeof (data === null || data === void 0 ? void 0 : data.decimalPrecision) !== "undefined" ? data === null || data === void 0 ? void 0 : data.decimalPrecision : decimalPrecisionDefault; let dpiDefault = 72; this.dpi = typeof (data === null || data === void 0 ? void 0 : data.dpi) !== "undefined" ? data === null || data === void 0 ? void 0 : data.dpi : dpiDefault; let graphicsStateModeDefault = "centralize"; this.graphicsStateMode = typeof (data === null || data === void 0 ? void 0 : data.graphicsStateMode) !== "undefined" ? data === null || data === void 0 ? void 0 : data.graphicsStateMode : graphicsStateModeDefault; 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 metricsDefault = "mm"; this.metrics = typeof (data === null || data === void 0 ? void 0 : data.metrics) !== "undefined" ? data === null || data === void 0 ? void 0 : data.metrics : metricsDefault; let pathDrawModeDefault = "compact"; this.pathDrawMode = typeof (data === null || data === void 0 ? void 0 : data.pathDrawMode) !== "undefined" ? data === null || data === void 0 ? void 0 : data.pathDrawMode : pathDrawModeDefault; 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 getDecimalPrecisionDefault() { return 2; } static getDecimalPrecisionDescription() { return "Selects the number of decimal places for numeric values of the resulting SVG.\n\n**Important:** The number of decimal places directly influences the size of the resulting file. However: Higher values will result in a better SVG quality."; } static getDecimalPrecisionMin() { return 0; } static getDecimalPrecisionMax() { return 10; } static getDpiDefault() { return 72; } static getDpiDescription() { return "This parameter is used to define the image's DPI resolution. The larger the value, the larger the image's x, y resolution. In addition, the larger the DPI resolution, the larger the size of the image file."; } static getDpiMin() { return 0; } static getDpiMax() { return 9600; } static getGraphicsStateModeDefault() { return "centralize"; } static getGraphicsStateModeDescription() { return "Selects the SVG syntax used for formatting graphics states.\n\n* verbose = Writes verbose graphics states and groups and always prefers direct path definitions.\n* centralize = Writes compact graphics states and groups and centralizes formatting instructions, also utilizes the \"use\" syntax to prepare and reference indirect paths. (May not be readable by some SVG viewers.)"; } static getHeightDefault() { return 0; } static getHeightDescription() { return "Used to limit the maximum height of the exported image. 0 = No restriction"; } static getHeightMin() { return 0; } static getMetricsDefault() { return "mm"; } static getMetricsDescription() { return "Unit for the X-axis\/Y-axis position and signature field height and width arguments:\n\n* pt = Points(1\/72 inch)\n* pc = Picas(12 points)\n* px = Pixels(1\/96 inch)\n* mm = Millimeters\n* in = Inches"; } static getPathDrawModeDefault() { return "compact"; } static getPathDrawModeDescription() { return "Selects the SVG syntax used for formatting paths.\n\n* verbose = Writes verbose paths, containing a human readable complete and simple syntax.\n* compress = Compresses path draw instructions, by applying the EBNF (Extended Backus Naur Form)."; } static getWidthDefault() { return 0; } static getWidthDescription() { return "Used to limit the maximum width of the exported image. 0 = No restriction"; } static getWidthMin() { return 0; } static fromJson(data) { if (data === undefined || data === null) { return data; } return new Svg(data); } toJson() { return { 'decimalPrecision': this.decimalPrecision, 'dpi': this.dpi, 'graphicsStateMode': this.graphicsStateMode, 'height': this.height, 'metrics': this.metrics, 'pathDrawMode': this.pathDrawMode, 'width': this.width, }; } clone() { return Svg.fromJson(this.toJson()); } } exports.Svg = Svg; //# sourceMappingURL=Svg.js.map