@softvision/webpdf-wsclient-typescript
Version:
A simplified and optimized API client library for the webPDF server
50 lines • 2.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExtractToolboxAttachment = void 0;
const index_1 = require("./../index");
class ExtractToolboxAttachment {
constructor(data) {
let folderNameTemplateDefault = "page[%d]";
this.folderNameTemplate = typeof (data === null || data === void 0 ? void 0 : data.folderNameTemplate) !== "undefined" ? data === null || data === void 0 ? void 0 : data.folderNameTemplate : folderNameTemplateDefault;
this.selection = (data.selection || []).map(index_1.SelectionAttachment.fromJson);
let singleFileAsZipDefault = true;
this.singleFileAsZip = typeof (data === null || data === void 0 ? void 0 : data.singleFileAsZip) !== "undefined" ? data === null || data === void 0 ? void 0 : data.singleFileAsZip : singleFileAsZipDefault;
}
static getFolderNameTemplateDefault() {
return "page[%d]";
}
static getFolderNameTemplateDescription() {
return "Used to set the template for the page folders in the returned ZIP file. \"page\\[%d\\]\", for example, would result in a folder called \"page1\" for page 1, etc.";
}
static getSelectionDefault() {
return [];
}
static getSelectionDescription() {
return "";
}
static getSingleFileAsZipDefault() {
return true;
}
static getSingleFileAsZipDescription() {
return "The returned attachments will be combined to a common ZIP file, even if the selection is resulting in a single attachment to be selected. You can change this behaviour by setting this option to \"false\". In that case, this will expect to select a single attachment, that can be returned \"as is\".";
}
static fromJson(data) {
if (data === undefined || data === null) {
return data;
}
return new ExtractToolboxAttachment(data);
}
toJson() {
var _a;
return {
'folderNameTemplate': this.folderNameTemplate,
'selection': (_a = this.selection) === null || _a === void 0 ? void 0 : _a.map((data) => data.toJson()),
'singleFileAsZip': this.singleFileAsZip,
};
}
clone() {
return ExtractToolboxAttachment.fromJson(this.toJson());
}
}
exports.ExtractToolboxAttachment = ExtractToolboxAttachment;
//# sourceMappingURL=ExtractToolboxAttachment.js.map