UNPKG

@softvision/webpdf-wsclient-typescript

Version:

A simplified and optimized API client library for the webPDF server

70 lines 5.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToolboxSplitSplit = void 0; class ToolboxSplitSplit { constructor(data) { let fileNameTemplateDefault = "page[%d]"; this.fileNameTemplate = typeof (data === null || data === void 0 ? void 0 : data.fileNameTemplate) !== "undefined" ? data === null || data === void 0 ? void 0 : data.fileNameTemplate : fileNameTemplateDefault; let modeDefault = "last"; this.mode = typeof (data === null || data === void 0 ? void 0 : data.mode) !== "undefined" ? data === null || data === void 0 ? void 0 : data.mode : modeDefault; let pagesDefault = "1"; this.pages = typeof (data === null || data === void 0 ? void 0 : data.pages) !== "undefined" ? data === null || data === void 0 ? void 0 : data.pages : pagesDefault; 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; let startPageDefault = 1; this.startPage = typeof (data === null || data === void 0 ? void 0 : data.startPage) !== "undefined" ? data === null || data === void 0 ? void 0 : data.startPage : startPageDefault; } static getFileNameTemplateDefault() { return "page[%d]"; } static getFileNameTemplateDescription() { return "If the \"split\" operation generates a ZIP document (please refer to \"mode\"), this template can be used to define the file name of the PDF document in the ZIP document. The \"%d\" placeholder must be used in the template in order to define the PDF document page."; } static getModeDefault() { return "last"; } static getModeDescription() { return "Defines the mode used to split the PDF document.\n\n* last = Last page - Uses \"pages\" to define the last page that will be contained in the new PDF document.\n* first = First page - Uses \"pages\" to define the first page that will be contained in the new PDF document.\n* list = List of pages - Uses \"pages\" to define a list of pages that should be extracted from the document. A single PDF document will be created on the basis of this list.\n* single = Selected pages - Uses the \"pages\" attribute to define a list of pages that should be extracted from the document. And creates a ZIP file with the corresponding pages.\n* each = Every nth page - Uses the \"pages\" attribute to define the interval at which pages should be extracted. The \"startPage\" attribute is used to define the page on which the process will start. The result will be a ZIP file.\n* group = Group pages - Multiple pages will be added to a single PDF document. The \"pages\" attribute can be used to define how many pages will be saved in a single PDF document. The \"startPage\" attribute is used to define the page on which the process will start. The result will be a ZIP file.\n* burst = Ungroup pages - A new PDF document will be generated from each page. The result will be a ZIP file."; } static getPagesDefault() { return "1"; } static getPagesDescription() { return "Defines which page(s) should be used for the split operation. The page number can be an individual page, a page range, or a list (separated with commas) (e.g. \"1,5-6,9\"). The \"mode\" attribute defines whether a single page or a range of pages can be used: With \"last\" and \"first,\" an individual page is specified; with \"list,\" a list of pages can be used."; } static getSingleFileAsZipDefault() { return true; } static getSingleFileAsZipDescription() { return "Only mode with \"single\", \"burst\", \"each\", or \"group\". The returned pages will be generated as a ZIP file even if selection is used to select only one single file. You can change this behaviour by setting this option to \"false\". In this case, the page will not be zipped, and will instead be returned directly as is. However, this will only work if selection has been used to select one page and one page only."; } static getStartPageDefault() { return 1; } static getStartPageDescription() { return "Used for \"each\" and \"group\" in the \"mode\" attribute."; } static getStartPageMin() { return 1; } static fromJson(data) { if (data === undefined || data === null) { return data; } return new ToolboxSplitSplit(data); } toJson() { return { 'fileNameTemplate': this.fileNameTemplate, 'mode': this.mode, 'pages': this.pages, 'singleFileAsZip': this.singleFileAsZip, 'startPage': this.startPage, }; } clone() { return ToolboxSplitSplit.fromJson(this.toJson()); } } exports.ToolboxSplitSplit = ToolboxSplitSplit; //# sourceMappingURL=ToolboxSplitSplit.js.map