![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/libs/absol-full/dist/js/ |
Upload File : |
/*** module: node_modules/absol/src/Print/printer.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.downloadAsPDF = downloadAsPDF; Object.defineProperty(exports, "PrintSerializer", { enumerable: true, get: function () { return _PrintSerializer.default; } }); Object.defineProperty(exports, "PaperPrinter", { enumerable: true, get: function () { return _PaperPrinter.default; } }); Object.defineProperty(exports, "mergePdfs", { enumerable: true, get: function () { return _pdf.mergePdfs; } }); exports.ShareSerializer = void 0; var _Dom = _interopRequireWildcard(require("../HTML5/Dom")); var _PrintSerializer = _interopRequireDefault(require("./PrintSerializer")); var _PaperPrinter = _interopRequireDefault(require("./PaperPrinter")); var _FileSaver = require("../Network/FileSaver"); var _pdf = require("./pdf"); var ShareSerializer = new _PrintSerializer.default(); exports.ShareSerializer = ShareSerializer; /*** * * @param elt * @param fileName * @param {function(processInfo):void=} onProcess * @returns {Promise<*>} */ /** * @type {((elt:AElement, fileName: string, onProcess: function(processInfo):void) => Promise ) & ((elt:AElement, opt: object, onProcess: function(processInfo):void) => Promise) } */ function downloadAsPDF(docList, arg2, onProcess) { var opt = { fileName: 'exports.pdf.js' }; if (typeof arg2 === 'string') opt.fileName = arg2;else Object.assign(opt, arg2); var $ = _Dom.default.ShareInstance.$; if (!(docList instanceof Array)) docList = [docList]; docList = docList.map(doc => { if (typeof doc === "string") { return { elt: $(doc) }; } else if ((0, _Dom.isDomNode)(doc)) { return { elt: $(doc) }; } else if (typeof doc === "object" && doc) { if (typeof doc.elt === "string") doc.elt = $(doc.elt); if (doc.elt && (0, _Dom.isDomNode)(doc.elt)) return doc; } else return null; }).filter(it => !!it).map(doc => { var elt = docList[0]; if (elt.fmComponent) { if (!doc.opt) doc.opt = {}; if (!doc.opt.margin) { doc.opt.margin = { top: elt.fmComponent.style.paddingTop || 57, left: elt.fmComponent.style.paddingLeft || 57, bottom: elt.fmComponent.style.paddingBottom || 57, right: elt.fmComponent.style.paddingRight || 57 }; } } return doc; }); var serializer = ShareSerializer; opt.onProcess = typeof onProcess === "function" ? onProcess : function () {}; var printer = new _PaperPrinter.default(opt); return serializer.serialize(docList, printer, opt.onProcess).then(printer => printer.exportAsPDF()).then(doc => { (0, _FileSaver.saveAs)(doc.output('blob'), opt.fileName); }); }