UNPKG

@softvision/webpdf-wsclient-typescript

Version:

A simplified and optimized API client library for the webPDF server

185 lines 10.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Converter = void 0; const index_1 = require("./../index"); class Converter { constructor(data) { let accessPasswordDefault = ""; this.accessPassword = typeof (data === null || data === void 0 ? void 0 : data.accessPassword) !== "undefined" ? data === null || data === void 0 ? void 0 : data.accessPassword : accessPasswordDefault; let compressionDefault = true; this.compression = typeof (data === null || data === void 0 ? void 0 : data.compression) !== "undefined" ? data === null || data === void 0 ? void 0 : data.compression : compressionDefault; let dpiDefault = 300; this.dpi = typeof (data === null || data === void 0 ? void 0 : data.dpi) !== "undefined" ? data === null || data === void 0 ? void 0 : data.dpi : dpiDefault; let embedFontsDefault = false; this.embedFonts = typeof (data === null || data === void 0 ? void 0 : data.embedFonts) !== "undefined" ? data === null || data === void 0 ? void 0 : data.embedFonts : embedFontsDefault; let fileExtensionDefault = ""; this.fileExtension = typeof (data === null || data === void 0 ? void 0 : data.fileExtension) !== "undefined" ? data === null || data === void 0 ? void 0 : data.fileExtension : fileExtensionDefault; this.html = index_1.ConverterHtml.fromJson(data === null || data === void 0 ? void 0 : data.html); this.image = index_1.ConverterImage.fromJson(data === null || data === void 0 ? void 0 : data.image); let jpegQualityDefault = 90; this.jpegQuality = typeof (data === null || data === void 0 ? void 0 : data.jpegQuality) !== "undefined" ? data === null || data === void 0 ? void 0 : data.jpegQuality : jpegQualityDefault; this.mail = index_1.ConverterMail.fromJson(data === null || data === void 0 ? void 0 : data.mail); let maxRecursionDefault = 1; this.maxRecursion = typeof (data === null || data === void 0 ? void 0 : data.maxRecursion) !== "undefined" ? data === null || data === void 0 ? void 0 : data.maxRecursion : maxRecursionDefault; this.office = index_1.ConverterOffice.fromJson(data === null || data === void 0 ? void 0 : data.office); this.officeBridge = index_1.OfficeBridge.fromJson(data === null || data === void 0 ? void 0 : data.officeBridge); this.page = index_1.ConverterPage.fromJson(data === null || data === void 0 ? void 0 : data.page); let pagesDefault = ""; this.pages = typeof (data === null || data === void 0 ? void 0 : data.pages) !== "undefined" ? data === null || data === void 0 ? void 0 : data.pages : pagesDefault; this.pdfa = index_1.Pdfa.fromJson(data === null || data === void 0 ? void 0 : data.pdfa); let reduceResolutionDefault = false; this.reduceResolution = typeof (data === null || data === void 0 ? void 0 : data.reduceResolution) !== "undefined" ? data === null || data === void 0 ? void 0 : data.reduceResolution : reduceResolutionDefault; this.report = index_1.ConverterReport.fromJson(data === null || data === void 0 ? void 0 : data.report); this.sharePointBridge = index_1.SharePointBridge.fromJson(data === null || data === void 0 ? void 0 : data.sharePointBridge); this.signature = index_1.Signature.fromJson(data === null || data === void 0 ? void 0 : data.signature); this.template = index_1.ConverterTemplate.fromJson(data === null || data === void 0 ? void 0 : data.template); this.text = index_1.ConverterText.fromJson(data === null || data === void 0 ? void 0 : data.text); this.transform = index_1.ConverterTransform.fromJson(data === null || data === void 0 ? void 0 : data.transform); } static getAccessPasswordDefault() { return ""; } static getAccessPasswordDescription() { return "This parameter can be used to declare a password that will be used to open the source document if it is protected.\n\n**Important:** This option is currently only supported for Microsoft Office 97-2003 binary documents and Microsoft Office 2007 documents. Only the default password methods are supported. Encryption based on digital certificates is not supported."; } static getCompressionDefault() { return true; } static getCompressionDescription() { return "If \"true,\" the data objects in the PDF document will be compressed (ZLib compression), reducing the size of the document."; } static getDpiDefault() { return 300; } static getDpiDescription() { return "Used to set the DPI solution (pixels per inch) for images."; } static getDpiMin() { return 0; } static getDpiMax() { return 9600; } static getEmbedFontsDefault() { return false; } static getEmbedFontsDescription() { return "If \"true,\" fonts will be embedded in the PDF document that is created.\n\n**Important:**: If the original fonts are not available on the conversion system, substitute fonts may be embedded instead.\n\n**Important:**: If, after the conversion, you want to convert the PDF document to PDF\/A, you should not embed any of the fonts, but should instead let the \"Pdfa\" web service do this."; } static getFileExtensionDefault() { return ""; } static getFileExtensionDescription() { return "If you use this attribute to enter an extension for the file (e.g., \"doc\") that is currently being processed, automatic file format detection will be disabled. Normally, webPDF does not detect file formats based on the corresponding file extension, but on the file contents instead. Accordingly, webPDF will analyze the file and assign the file the appropriate \"mime-type\" so that the appropriate file converter can then be selected.\n\n**Important:**: You should only set a file extension in exceptional cases, as this will completely disable automatic detection. If, for instance, you specify an extension for which webPDF does not have a \"mime-type,\" the conversion will fail."; } static getHtmlDescription() { return ""; } static getImageDescription() { return ""; } static getJpegQualityDefault() { return 90; } static getJpegQualityDescription() { return "Used to set the quality (as a percentage) of JPEG images in the PDF document."; } static getJpegQualityMin() { return 0; } static getJpegQualityMax() { return 100; } static getMailDescription() { return ""; } static getMaxRecursionDefault() { return 1; } static getMaxRecursionDescription() { return "Sets the maximum recursions, that may occur when converting a document's attachments.\n\n**Important:** This parameter is intended for internal use only. Please only use this, if you really are sure you need to do so."; } static getMaxRecursionMin() { return 1; } static getOfficeDescription() { return ""; } static getOfficeBridgeDescription() { return ""; } static getPageDescription() { return ""; } static getPagesDefault() { return ""; } static getPagesDescription() { return "A text that defines the page range for the export. Individual pages or a range of pages can be defined here. If the text is empty, the entire file will be exported (e.g.: \"1-10\" or \"1,2,5-10\")"; } static getPdfaDescription() { return ""; } static getReduceResolutionDefault() { return false; } static getReduceResolutionDescription() { return "If \"true,\" then the DPI resolution of graphics is reduced. The reduction value is set with \"dpi.\""; } static getReportDescription() { return ""; } static getSharePointBridgeDescription() { return ""; } static getSignatureDescription() { return ""; } static getTemplateDescription() { return ""; } static getTextDescription() { return ""; } static getTransformDescription() { return ""; } static fromJson(data) { if (data === undefined || data === null) { return data; } return new Converter(data); } toJson() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; return { 'accessPassword': this.accessPassword, 'compression': this.compression, 'dpi': this.dpi, 'embedFonts': this.embedFonts, 'fileExtension': this.fileExtension, 'html': (_a = this.html) === null || _a === void 0 ? void 0 : _a.toJson(), 'image': (_b = this.image) === null || _b === void 0 ? void 0 : _b.toJson(), 'jpegQuality': this.jpegQuality, 'mail': (_c = this.mail) === null || _c === void 0 ? void 0 : _c.toJson(), 'maxRecursion': this.maxRecursion, 'office': (_d = this.office) === null || _d === void 0 ? void 0 : _d.toJson(), 'officeBridge': (_e = this.officeBridge) === null || _e === void 0 ? void 0 : _e.toJson(), 'page': (_f = this.page) === null || _f === void 0 ? void 0 : _f.toJson(), 'pages': this.pages, 'pdfa': (_g = this.pdfa) === null || _g === void 0 ? void 0 : _g.toJson(), 'reduceResolution': this.reduceResolution, 'report': (_h = this.report) === null || _h === void 0 ? void 0 : _h.toJson(), 'sharePointBridge': (_j = this.sharePointBridge) === null || _j === void 0 ? void 0 : _j.toJson(), 'signature': (_k = this.signature) === null || _k === void 0 ? void 0 : _k.toJson(), 'template': (_l = this.template) === null || _l === void 0 ? void 0 : _l.toJson(), 'text': (_m = this.text) === null || _m === void 0 ? void 0 : _m.toJson(), 'transform': (_o = this.transform) === null || _o === void 0 ? void 0 : _o.toJson(), }; } clone() { return Converter.fromJson(this.toJson()); } } exports.Converter = Converter; //# sourceMappingURL=Converter.js.map