@sv-print/plugin-api-pdf 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +99 -98
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @sv-print/plugin-api-pdf
|
|
2
|
+
|
|
3
|
+
给 sv-print 提供导出 PDF 的 API 插件。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @sv-print/plugin-api-pdf
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import pluginApiPdf from "@sv-print/plugin-api-pdf";
|
|
13
|
+
const plugins = [pluginApiPdf({})];
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 示例
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
let hiprintTemplate = new hiprint.PrintTemplate(options);
|
|
20
|
+
// 其中 “text” 是一个元素的 “字段名(field)”
|
|
21
|
+
let printData = { text: "这是打印时显示的文本" };
|
|
22
|
+
const res = await hiprintTemplate.toPdf(printData, "pdf名称", {
|
|
23
|
+
isDownload: false, // 不自动下载
|
|
24
|
+
type: "blob", // 默认 blob 支持: blob、bloburl、pdfobjectnewwindow、dataurl --> jspdf.output(type)
|
|
25
|
+
onProgress: (cur, total) => {
|
|
26
|
+
const percent = Math.floor((cur / total) * 100);
|
|
27
|
+
console.log("toPdf 进度", percent);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
console.log("toPdf", res);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
LGPL
|
|
36
|
+
|
|
37
|
+
### 开源使用须知
|
|
38
|
+
|
|
39
|
+
1.请自觉遵守 LGPL 协议,其他用途可联系作者;
|
|
40
|
+
|
|
41
|
+
2.允许用于个人学习、毕业设计、教学案例、公益事业、商业使用;
|
|
42
|
+
|
|
43
|
+
3.如果商用必须保留版权信息,请自觉遵守;
|
|
44
|
+
|
|
45
|
+
4.禁止将本开源的代码和资源进行任何形式任何名义的出售,否则产生的一切任何后果责任由侵权者自负;
|
|
46
|
+
|
|
47
|
+
5.商用请仔细审查代码和漏洞,不得用于任一国家许可范围之外的商业应用,产生的一切任何后果责任自负;
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var _=(x,n,t)=>new Promise((e,i)=>{var s=f=>{try{u(t.next(f))}catch(d){i(d)}},m=f=>{try{u(t.throw(f))}catch(d){i(d)}},u=f=>f.done?e(f.value):Promise.resolve(f.value).then(s,m);u((t=t.apply(x,n)).next())});const L=require("html-to-image"),M=require("jspdf");function S(x){if(x&&x.__esModule)return x;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(x){for(const t in x)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(x,t);Object.defineProperty(n,t,e.get?e:{enumerable:!0,get:()=>x[t]})}}return n.default=x,Object.freeze(n)}const A=S(L);(function(x,n){for(var t=P,e=x();[];)try{var i=-parseInt(t(219))/1*(-parseInt(t(220))/2)+-parseInt(t(243))/3+-parseInt(t(227))/4+parseInt(t(279))/5*(-parseInt(t(242))/6)+parseInt(t(239))/7*(parseInt(t(266))/8)+-parseInt(t(285))/9+parseInt(t(229))/10;if(i===n)break;e.push(e.shift())}catch(s){e.push(e.shift())}})(T,176031);function P(x,n){var t=T();return P=function(e,i){e=e-218;var s=t[e];return s},P(x,n)}const F=function(x,n,t){return _(this,null,function*(){var e=P,i=this,s=globalThis.$[e(244)](),m=!![];let u=(l,v)=>{var b=e;const a=Math.floor(l/v*100);console.log(b(218),l,b(264),v),console[b(263)]("toPdf percent: ",a+"%")};if(this[e(286)][e(231)]){var f=globalThis[e(269)].mm[e(253)](this[e(286)][0][e(270)]),d=globalThis[e(269)].mm[e(253)](this.printPanels[0][e(223)]),j=globalThis.$.extend({filter:a=>{var r=e;return a.tagName!=r(287)||a.tagName=="IMG"&&([r(222),r(280),r(258),"gif",r(241),r(256),r(230)][r(254)](a.src[r(281)](".")[r(248)]()[r(224)]())||a.src!=a[r(271)]||a.src.indexOf("http")>-1&&a[r(255)]!=a[r(271)]||a[r(255)][r(226)](r(247))>-1)},backgroundColor:e(228)},t||{});const l=this.printPanels[0][e(261)],v=l!=null&&l!=""&&l!=e(221);var h=new M.jsPDF({orientation:this[e(234)](0)==1?"portrait":e(233),unit:"pt",format:v?l[e(262)]():[f,d]}),g=yield this[e(273)](x,t);t&&t[e(277)]!=null&&(m=t.isDownload),t&&t.onProgress!=null&&(u=t.onProgress),globalThis.$(g)[e(265)](e(270),"")[e(265)](e(223),""),this[e(284)]();var C=this[e(267)]();this[e(283)](g,j),C[e(236)](g[0]);let b=C[e(276)](e(272)).length;globalThis.$(g)[e(265)](e(240)),this[e(235)](g,function(){var a=e;try{C[a(276)](".hiprint-printPanel .hiprint-printPaper")[a(237)](function(r,q){var p=a;globalThis[p(269)][p(249)][p(252)](function(O){var o=p;A.toCanvas(q,j)[o(278)](function(I){var c=o,D=I[c(238)]("2d");D[c(274)]=![];var k=I.toDataURL(c(251),j[c(245)]||.92);h[c(232)](k,c(259),0,0,f,d),r<b-1&&h.addPage(),u(r+1,b),O()})}),r==b-1&&(globalThis[p(269)].queue[p(252)](function(O){var o=p;if(m)i.removeTempContainer(),n[o(226)](o(257))>-1?h.save(n):h.save(n+o(257));else{i.removeTempContainer();let I=t[o(282)]||o(246),c=h[o(268)](I);s[o(250)](c)}globalThis[o(269)][o(249)][o(288)]()}),globalThis[p(269)][p(249)][p(225)]())})}catch(r){console[a(275)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "),console.log(r)}})}return s[e(260)]()})};function T(){var x=["126tSCgXA","525129zjKAbq","Deferred","quality","blob","base64","pop","queue","resolve","image/jpeg","add","toPt","includes","src","webp",".pdf","png","JPEG","promise","paperType","toLocaleLowerCase","log","total","css","8896yVUbSh","getTempContainer","output","hinnn","width","baseURI",".hiprint-printPanel .hiprint-printPaper","getHtml","imageSmoothingEnabled","error","find","isDownload","then","48295IFKXEc","jpeg","split","type","svg2canvas","createTempContainer","2474244rLXIHk","printPanels","IMG","clear","cur","28321uPIPma","10pcUdri","\u81EA\u5B9A\u4E49","jpg","height","toLowerCase","run","indexOf","616092WBemXG","#fff","5165430qCcCya","svg","length","addImage","landscape","getOrient","loadAllImages","html","each","getContext","2044bDOmYT","position:fixed","bmp"];return T=function(){return x},T()}(function(x,n){for(var t=y,e=x();[];)try{var i=-parseInt(t(437))/1*(-parseInt(t(438))/2)+parseInt(t(442))/3*(parseInt(t(432))/4)+-parseInt(t(439))/5*(-parseInt(t(436))/6)+-parseInt(t(447))/7+-parseInt(t(434))/8+parseInt(t(433))/9+-parseInt(t(446))/10*(-parseInt(t(441))/11);if(i===n)break;e.push(e.shift())}catch(s){e.push(e.shift())}})(w,620196);function y(x,n){var t=w();return y=function(e,i){e=e-432;var s=t[e];return s},y(x,n)}function z(x){var n=y;return{name:n(444),description:n(444),hooks:[{hook:n(443),name:n(440),description:n(440),priority:1,run:({template:t,options:e})=>{var i=n;Object[i(435)](t,i(445),{value:F,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}function w(){var x=["7908523goyyri","17076opfbYs","987075HDZSFT","2837552bcFiTM","defineProperty","79998JfzewA","1zNsKFV","485556bmEBze","110MFLttU","add toPdf Api to PrintTemplate","3817cLRxoS","489aaaqip","newPrintTemplate","add toPdf Api","toPdf","21990nvmIEy"];return w=function(){return x},w()}module.exports=z;
|
package/dist/index.mjs
CHANGED
|
@@ -1,129 +1,130 @@
|
|
|
1
|
-
var
|
|
2
|
-
var s = (
|
|
1
|
+
var j = (r, n, x) => new Promise((e, i) => {
|
|
2
|
+
var s = (f) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
4
|
+
h(x.next(f));
|
|
5
|
+
} catch (u) {
|
|
6
|
+
i(u);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, v = (f) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
10
|
+
h(x.throw(f));
|
|
11
|
+
} catch (u) {
|
|
12
|
+
i(u);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, h = (f) => f.done ? e(f.value) : Promise.resolve(f.value).then(s, v);
|
|
15
|
+
h((x = x.apply(r, n)).next());
|
|
16
16
|
});
|
|
17
|
-
import * as
|
|
18
|
-
import { jsPDF as
|
|
19
|
-
function
|
|
20
|
-
var
|
|
21
|
-
return v = function(x, o) {
|
|
22
|
-
x = x - 164;
|
|
23
|
-
var s = t[x];
|
|
24
|
-
return s;
|
|
25
|
-
}, v(r, a);
|
|
26
|
-
}
|
|
27
|
-
(function(r, a) {
|
|
28
|
-
for (var t = v, x = r(); []; )
|
|
17
|
+
import * as F from "html-to-image";
|
|
18
|
+
import { jsPDF as E } from "jspdf";
|
|
19
|
+
(function(r, n) {
|
|
20
|
+
for (var x = P, e = r(); []; )
|
|
29
21
|
try {
|
|
30
|
-
var
|
|
31
|
-
if (
|
|
22
|
+
var i = -parseInt(x(219)) / 1 * (-parseInt(x(220)) / 2) + -parseInt(x(243)) / 3 + -parseInt(x(227)) / 4 + parseInt(x(279)) / 5 * (-parseInt(x(242)) / 6) + parseInt(x(239)) / 7 * (parseInt(x(266)) / 8) + -parseInt(x(285)) / 9 + parseInt(x(229)) / 10;
|
|
23
|
+
if (i === n)
|
|
32
24
|
break;
|
|
33
|
-
|
|
25
|
+
e.push(e.shift());
|
|
34
26
|
} catch (s) {
|
|
35
|
-
|
|
27
|
+
e.push(e.shift());
|
|
36
28
|
}
|
|
37
|
-
})(
|
|
38
|
-
function P() {
|
|
39
|
-
var
|
|
40
|
-
return P = function() {
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
})(T, 176031);
|
|
30
|
+
function P(r, n) {
|
|
31
|
+
var x = T();
|
|
32
|
+
return P = function(e, i) {
|
|
33
|
+
e = e - 218;
|
|
34
|
+
var s = x[e];
|
|
35
|
+
return s;
|
|
36
|
+
}, P(r, n);
|
|
43
37
|
}
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
var
|
|
47
|
-
let
|
|
48
|
-
var
|
|
49
|
-
const
|
|
50
|
-
console
|
|
38
|
+
const M = function(r, n, x) {
|
|
39
|
+
return j(this, null, function* () {
|
|
40
|
+
var e = P, i = this, s = globalThis.$[e(244)](), v = !![];
|
|
41
|
+
let h = (c, m) => {
|
|
42
|
+
var b = e;
|
|
43
|
+
const a = Math.floor(c / m * 100);
|
|
44
|
+
console.log(b(218), c, b(264), m), console[b(263)]("toPdf percent: ", a + "%");
|
|
51
45
|
};
|
|
52
|
-
if (this
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
return
|
|
56
|
-
}, backgroundColor:
|
|
57
|
-
const
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
var
|
|
61
|
-
this[
|
|
62
|
-
let
|
|
63
|
-
globalThis.$(g)[
|
|
64
|
-
var
|
|
46
|
+
if (this[e(286)][e(231)]) {
|
|
47
|
+
var f = globalThis[e(269)].mm[e(253)](this[e(286)][0][e(270)]), u = globalThis[e(269)].mm[e(253)](this.printPanels[0][e(223)]), C = globalThis.$.extend({ filter: (a) => {
|
|
48
|
+
var t = e;
|
|
49
|
+
return a.tagName != t(287) || a.tagName == "IMG" && ([t(222), t(280), t(258), "gif", t(241), t(256), t(230)][t(254)](a.src[t(281)](".")[t(248)]()[t(224)]()) || a.src != a[t(271)] || a.src.indexOf("http") > -1 && a[t(255)] != a[t(271)] || a[t(255)][t(226)](t(247)) > -1);
|
|
50
|
+
}, backgroundColor: e(228) }, x || {});
|
|
51
|
+
const c = this.printPanels[0][e(261)], m = c != null && c != "" && c != e(221);
|
|
52
|
+
var d = new E({ orientation: this[e(234)](0) == 1 ? "portrait" : e(233), unit: "pt", format: m ? c[e(262)]() : [f, u] }), g = yield this[e(273)](r, x);
|
|
53
|
+
x && x[e(277)] != null && (v = x.isDownload), x && x.onProgress != null && (h = x.onProgress), globalThis.$(g)[e(265)](e(270), "")[e(265)](e(223), ""), this[e(284)]();
|
|
54
|
+
var D = this[e(267)]();
|
|
55
|
+
this[e(283)](g, C), D[e(236)](g[0]);
|
|
56
|
+
let b = D[e(276)](e(272)).length;
|
|
57
|
+
globalThis.$(g)[e(265)](e(240)), this[e(235)](g, function() {
|
|
58
|
+
var a = e;
|
|
65
59
|
try {
|
|
66
|
-
|
|
67
|
-
var p =
|
|
68
|
-
globalThis[p(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
D[a(276)](".hiprint-printPanel .hiprint-printPaper")[a(237)](function(t, k) {
|
|
61
|
+
var p = a;
|
|
62
|
+
globalThis[p(269)][p(249)][p(252)](function(L) {
|
|
63
|
+
var o = p;
|
|
64
|
+
F.toCanvas(k, C)[o(278)](function(I) {
|
|
65
|
+
var l = o, q = I[l(238)]("2d");
|
|
66
|
+
q[l(274)] = ![];
|
|
67
|
+
var A = I.toDataURL(l(251), C[l(245)] || 0.92);
|
|
68
|
+
d[l(232)](A, l(259), 0, 0, f, u), t < b - 1 && d.addPage(), h(t + 1, b), L();
|
|
74
69
|
});
|
|
75
|
-
}),
|
|
76
|
-
var
|
|
77
|
-
if (
|
|
78
|
-
|
|
70
|
+
}), t == b - 1 && (globalThis[p(269)].queue[p(252)](function(L) {
|
|
71
|
+
var o = p;
|
|
72
|
+
if (v)
|
|
73
|
+
i.removeTempContainer(), n[o(226)](o(257)) > -1 ? d.save(n) : d.save(n + o(257));
|
|
79
74
|
else {
|
|
80
|
-
|
|
81
|
-
let
|
|
82
|
-
s
|
|
75
|
+
i.removeTempContainer();
|
|
76
|
+
let I = x[o(282)] || o(246), l = d[o(268)](I);
|
|
77
|
+
s[o(250)](l);
|
|
83
78
|
}
|
|
84
|
-
globalThis[
|
|
85
|
-
}), globalThis[p(
|
|
79
|
+
globalThis[o(269)][o(249)][o(288)]();
|
|
80
|
+
}), globalThis[p(269)][p(249)][p(225)]());
|
|
86
81
|
});
|
|
87
|
-
} catch (
|
|
88
|
-
console[
|
|
82
|
+
} catch (t) {
|
|
83
|
+
console[a(275)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "), console.log(t);
|
|
89
84
|
}
|
|
90
85
|
});
|
|
91
86
|
}
|
|
92
|
-
return s[
|
|
87
|
+
return s[e(260)]();
|
|
93
88
|
});
|
|
94
89
|
};
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
function T() {
|
|
91
|
+
var r = ["126tSCgXA", "525129zjKAbq", "Deferred", "quality", "blob", "base64", "pop", "queue", "resolve", "image/jpeg", "add", "toPt", "includes", "src", "webp", ".pdf", "png", "JPEG", "promise", "paperType", "toLocaleLowerCase", "log", "total", "css", "8896yVUbSh", "getTempContainer", "output", "hinnn", "width", "baseURI", ".hiprint-printPanel .hiprint-printPaper", "getHtml", "imageSmoothingEnabled", "error", "find", "isDownload", "then", "48295IFKXEc", "jpeg", "split", "type", "svg2canvas", "createTempContainer", "2474244rLXIHk", "printPanels", "IMG", "clear", "cur", "28321uPIPma", "10pcUdri", "\u81EA\u5B9A\u4E49", "jpg", "height", "toLowerCase", "run", "indexOf", "616092WBemXG", "#fff", "5165430qCcCya", "svg", "length", "addImage", "landscape", "getOrient", "loadAllImages", "html", "each", "getContext", "2044bDOmYT", "position:fixed", "bmp"];
|
|
92
|
+
return T = function() {
|
|
93
|
+
return r;
|
|
94
|
+
}, T();
|
|
95
|
+
}
|
|
96
|
+
(function(r, n) {
|
|
97
|
+
for (var x = y, e = r(); []; )
|
|
97
98
|
try {
|
|
98
|
-
var
|
|
99
|
-
if (
|
|
99
|
+
var i = -parseInt(x(437)) / 1 * (-parseInt(x(438)) / 2) + parseInt(x(442)) / 3 * (parseInt(x(432)) / 4) + -parseInt(x(439)) / 5 * (-parseInt(x(436)) / 6) + -parseInt(x(447)) / 7 + -parseInt(x(434)) / 8 + parseInt(x(433)) / 9 + -parseInt(x(446)) / 10 * (-parseInt(x(441)) / 11);
|
|
100
|
+
if (i === n)
|
|
100
101
|
break;
|
|
101
|
-
|
|
102
|
+
e.push(e.shift());
|
|
102
103
|
} catch (s) {
|
|
103
|
-
|
|
104
|
+
e.push(e.shift());
|
|
104
105
|
}
|
|
105
|
-
})(
|
|
106
|
-
function
|
|
107
|
-
var
|
|
108
|
-
return
|
|
109
|
-
|
|
110
|
-
var s =
|
|
106
|
+
})(w, 620196);
|
|
107
|
+
function y(r, n) {
|
|
108
|
+
var x = w();
|
|
109
|
+
return y = function(e, i) {
|
|
110
|
+
e = e - 432;
|
|
111
|
+
var s = x[e];
|
|
111
112
|
return s;
|
|
112
|
-
},
|
|
113
|
+
}, y(r, n);
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
-
var
|
|
116
|
-
return
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
function U(r) {
|
|
116
|
+
var n = y;
|
|
117
|
+
return { name: n(444), description: n(444), hooks: [{ hook: n(443), name: n(440), description: n(440), priority: 1, run: ({ template: x, options: e }) => {
|
|
118
|
+
var i = n;
|
|
119
|
+
Object[i(435)](x, i(445), { value: M, enumerable: ![], writable: !![], configurable: !![] });
|
|
120
|
+
} }], leastHiprintVersion: "0.3.0" };
|
|
119
121
|
}
|
|
120
|
-
function
|
|
121
|
-
var
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} }], leastHiprintVersion: a(273) };
|
|
122
|
+
function w() {
|
|
123
|
+
var r = ["7908523goyyri", "17076opfbYs", "987075HDZSFT", "2837552bcFiTM", "defineProperty", "79998JfzewA", "1zNsKFV", "485556bmEBze", "110MFLttU", "add toPdf Api to PrintTemplate", "3817cLRxoS", "489aaaqip", "newPrintTemplate", "add toPdf Api", "toPdf", "21990nvmIEy"];
|
|
124
|
+
return w = function() {
|
|
125
|
+
return r;
|
|
126
|
+
}, w();
|
|
126
127
|
}
|
|
127
128
|
export {
|
|
128
|
-
|
|
129
|
+
U as default
|
|
129
130
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(f,d){typeof exports=="object"&&typeof module!="undefined"?module.exports=d(require("html-to-image"),require("jspdf")):typeof define=="function"&&define.amd?define(["html-to-image","jspdf"],d):(f=typeof globalThis!="undefined"?globalThis:f||self,f.pluginApiPdf=d(f.htmlToImage,f.jspdf))})(this,function(f,d){"use strict";var M=(f,d,v)=>new Promise((w,h)=>{var C=p=>{try{c(v.next(p))}catch(l){h(l)}},I=p=>{try{c(v.throw(p))}catch(l){h(l)}},c=p=>p.done?w(p.value):Promise.resolve(p.value).then(C,I);c((v=v.apply(f,d)).next())});function v(n){if(n&&n.__esModule)return n;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(r,t,e.get?e:{enumerable:!0,get:()=>n[t]})}}return r.default=n,Object.freeze(r)}const w=v(f);(function(n,r){for(var t=h,e=n();[];)try{var o=-parseInt(t(219))/1*(-parseInt(t(220))/2)+-parseInt(t(243))/3+-parseInt(t(227))/4+parseInt(t(279))/5*(-parseInt(t(242))/6)+parseInt(t(239))/7*(parseInt(t(266))/8)+-parseInt(t(285))/9+parseInt(t(229))/10;if(o===r)break;e.push(e.shift())}catch(u){e.push(e.shift())}})(I,176031);function h(n,r){var t=I();return h=function(e,o){e=e-218;var u=t[e];return u},h(n,r)}const C=function(n,r,t){return M(this,null,function*(){var e=h,o=this,u=globalThis.$[e(244)](),q=!![];let D=(g,y)=>{var m=e;const i=Math.floor(g/y*100);console.log(m(218),g,m(264),y),console[m(263)]("toPdf percent: ",i+"%")};if(this[e(286)][e(231)]){var k=globalThis[e(269)].mm[e(253)](this[e(286)][0][e(270)]),A=globalThis[e(269)].mm[e(253)](this.printPanels[0][e(223)]),O=globalThis.$.extend({filter:i=>{var x=e;return i.tagName!=x(287)||i.tagName=="IMG"&&([x(222),x(280),x(258),"gif",x(241),x(256),x(230)][x(254)](i.src[x(281)](".")[x(248)]()[x(224)]())||i.src!=i[x(271)]||i.src.indexOf("http")>-1&&i[x(255)]!=i[x(271)]||i[x(255)][x(226)](x(247))>-1)},backgroundColor:e(228)},t||{});const g=this.printPanels[0][e(261)],y=g!=null&&g!=""&&g!=e(221);var P=new d.jsPDF({orientation:this[e(234)](0)==1?"portrait":e(233),unit:"pt",format:y?g[e(262)]():[k,A]}),T=yield this[e(273)](n,t);t&&t[e(277)]!=null&&(q=t.isDownload),t&&t.onProgress!=null&&(D=t.onProgress),globalThis.$(T)[e(265)](e(270),"")[e(265)](e(223),""),this[e(284)]();var _=this[e(267)]();this[e(283)](T,O),_[e(236)](T[0]);let m=_[e(276)](e(272)).length;globalThis.$(T)[e(265)](e(240)),this[e(235)](T,function(){var i=e;try{_[i(276)](".hiprint-printPanel .hiprint-printPaper")[i(237)](function(x,S){var s=i;globalThis[s(269)][s(249)][s(252)](function(L){var a=s;w.toCanvas(S,O)[a(278)](function(j){var b=a,F=j[b(238)]("2d");F[b(274)]=![];var z=j.toDataURL(b(251),O[b(245)]||.92);P[b(232)](z,b(259),0,0,k,A),x<m-1&&P.addPage(),D(x+1,m),L()})}),x==m-1&&(globalThis[s(269)].queue[s(252)](function(L){var a=s;if(q)o.removeTempContainer(),r[a(226)](a(257))>-1?P.save(r):P.save(r+a(257));else{o.removeTempContainer();let j=t[a(282)]||a(246),b=P[a(268)](j);u[a(250)](b)}globalThis[a(269)][a(249)][a(288)]()}),globalThis[s(269)][s(249)][s(225)]())})}catch(x){console[i(275)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "),console.log(x)}})}return u[e(260)]()})};function I(){var n=["126tSCgXA","525129zjKAbq","Deferred","quality","blob","base64","pop","queue","resolve","image/jpeg","add","toPt","includes","src","webp",".pdf","png","JPEG","promise","paperType","toLocaleLowerCase","log","total","css","8896yVUbSh","getTempContainer","output","hinnn","width","baseURI",".hiprint-printPanel .hiprint-printPaper","getHtml","imageSmoothingEnabled","error","find","isDownload","then","48295IFKXEc","jpeg","split","type","svg2canvas","createTempContainer","2474244rLXIHk","printPanels","IMG","clear","cur","28321uPIPma","10pcUdri","\u81EA\u5B9A\u4E49","jpg","height","toLowerCase","run","indexOf","616092WBemXG","#fff","5165430qCcCya","svg","length","addImage","landscape","getOrient","loadAllImages","html","each","getContext","2044bDOmYT","position:fixed","bmp"];return I=function(){return n},I()}(function(n,r){for(var t=c,e=n();[];)try{var o=-parseInt(t(437))/1*(-parseInt(t(438))/2)+parseInt(t(442))/3*(parseInt(t(432))/4)+-parseInt(t(439))/5*(-parseInt(t(436))/6)+-parseInt(t(447))/7+-parseInt(t(434))/8+parseInt(t(433))/9+-parseInt(t(446))/10*(-parseInt(t(441))/11);if(o===r)break;e.push(e.shift())}catch(u){e.push(e.shift())}})(l,620196);function c(n,r){var t=l();return c=function(e,o){e=e-432;var u=t[e];return u},c(n,r)}function p(n){var r=c;return{name:r(444),description:r(444),hooks:[{hook:r(443),name:r(440),description:r(440),priority:1,run:({template:t,options:e})=>{var o=r;Object[o(435)](t,o(445),{value:C,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}function l(){var n=["7908523goyyri","17076opfbYs","987075HDZSFT","2837552bcFiTM","defineProperty","79998JfzewA","1zNsKFV","485556bmEBze","110MFLttU","add toPdf Api to PrintTemplate","3817cLRxoS","489aaaqip","newPrintTemplate","add toPdf Api","toPdf","21990nvmIEy"];return l=function(){return n},l()}return p});
|