UNPKG

@softvision/webpdf-wsclient-typescript

Version:

A simplified and optimized API client library for the webPDF server

97 lines 6.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConverterHtml = void 0; const index_1 = require("./../index"); class ConverterHtml { constructor(data) { let adjustFontsDefault = false; this.adjustFonts = typeof (data === null || data === void 0 ? void 0 : data.adjustFonts) !== "undefined" ? data === null || data === void 0 ? void 0 : data.adjustFonts : adjustFontsDefault; let baseURLDefault = ""; this.baseURL = typeof (data === null || data === void 0 ? void 0 : data.baseURL) !== "undefined" ? data === null || data === void 0 ? void 0 : data.baseURL : baseURLDefault; let downloadImagesDefault = false; this.downloadImages = typeof (data === null || data === void 0 ? void 0 : data.downloadImages) !== "undefined" ? data === null || data === void 0 ? void 0 : data.downloadImages : downloadImagesDefault; this.errorReport = index_1.ConverterHtmlErrorReport.fromJson(data === null || data === void 0 ? void 0 : data.errorReport); let imageModeDefault = "base64"; this.imageMode = typeof (data === null || data === void 0 ? void 0 : data.imageMode) !== "undefined" ? data === null || data === void 0 ? void 0 : data.imageMode : imageModeDefault; let preferCSSPageSizeDefault = false; this.preferCSSPageSize = typeof (data === null || data === void 0 ? void 0 : data.preferCSSPageSize) !== "undefined" ? data === null || data === void 0 ? void 0 : data.preferCSSPageSize : preferCSSPageSizeDefault; this.templateData = index_1.TemplateData.fromJson(data === null || data === void 0 ? void 0 : data.templateData); let useAsTemplateDefault = false; this.useAsTemplate = typeof (data === null || data === void 0 ? void 0 : data.useAsTemplate) !== "undefined" ? data === null || data === void 0 ? void 0 : data.useAsTemplate : useAsTemplateDefault; let useBackgroundDefault = true; this.useBackground = typeof (data === null || data === void 0 ? void 0 : data.useBackground) !== "undefined" ? data === null || data === void 0 ? void 0 : data.useBackground : useBackgroundDefault; } static getAdjustFontsDefault() { return false; } static getAdjustFontsDescription() { return "If \"true\", then the font specifications \"Arial\", \"Helvetica\" and \"Sans-Serif\" in HTML documents and e-mails (which are based on HTML) are automatically replaced by the \"Arial Unicode MS\" font. The improves the appearance of the typeface in the PDF result."; } static getBaseURLDefault() { return ""; } static getBaseURLDescription() { return "Used to define the URL that will be the base for all URLs in the HTML document that are not defined as absolute URLs. The URL must be absolute and contain a scheme (e.g. 'http' or 'https'); the scheme 'file' is not allowed."; } static getDownloadImagesDefault() { return false; } static getDownloadImagesDescription() { return "If \"true\", then externally referenced images of the HTML document are downloaded and inserted into the document. If false, the images are not downloaded and the external references to the image are removed, leaving already embedded images intact."; } static getErrorReportDescription() { return ""; } static getImageModeDefault() { return "base64"; } static getImageModeDescription() { return "This defines how downloaded images are inserted into the HTML content (with reference to the `<downloadImages>` parameter). When referencing large images in the HTML content, it is recommended to use `<file>` to reduce the size of the HTML file and speed up the rendering of the HTML.\n\n* base64 = embed images as BASE64 content\n* file = embed images as file links to local temporary files"; } static getPreferCSSPageSizeDefault() { return false; } static getPreferCSSPageSizeDescription() { return "If \"true\", then the page size and margins are preferentially used from the CSS. Otherwise, the sizes from the passed page parameter are used. The values can also be only partially overwritten, so that e.g. the page size is determined by the parameter values and the page margins are defined in the CSS."; } static getTemplateDataDescription() { return ""; } static getUseAsTemplateDefault() { return false; } static getUseAsTemplateDescription() { return "If \"true\", the HTML document will be interpreted as a template, i.e., the system will search for variables in the HTML and replace them with the data passed in \"templateData\". The document will not be converted to HTML format until after this step is completed. This means that by using the HTML document as a template together with passed data, you can obtain a dynamically generated PDF document."; } static getUseBackgroundDefault() { return true; } static getUseBackgroundDescription() { return "If \"true\", the background defined in the HTML document will be output in the PDF document as well. If \"false\", the background will be hidden."; } static fromJson(data) { if (data === undefined || data === null) { return data; } return new ConverterHtml(data); } toJson() { var _a, _b; return { 'adjustFonts': this.adjustFonts, 'baseURL': this.baseURL, 'downloadImages': this.downloadImages, 'errorReport': (_a = this.errorReport) === null || _a === void 0 ? void 0 : _a.toJson(), 'imageMode': this.imageMode, 'preferCSSPageSize': this.preferCSSPageSize, 'templateData': (_b = this.templateData) === null || _b === void 0 ? void 0 : _b.toJson(), 'useAsTemplate': this.useAsTemplate, 'useBackground': this.useBackground, }; } clone() { return ConverterHtml.fromJson(this.toJson()); } } exports.ConverterHtml = ConverterHtml; //# sourceMappingURL=ConverterHtml.js.map