@sv-print/plugin-api-pdf3 0.2.0 → 0.2.2
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/dist/index.js +1 -35
- package/dist/index.mjs +103 -157
- package/dist/index.umd.js +1 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,35 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
.hiprint-printPanel-small{
|
|
3
|
-
box-sizing: border-box;
|
|
4
|
-
border: 0px;
|
|
5
|
-
}
|
|
6
|
-
.hiprint-printPaper-small{
|
|
7
|
-
position: relative;
|
|
8
|
-
padding: 0;
|
|
9
|
-
}
|
|
10
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
11
|
-
margin: -`+(Number(i[x(212)])||0)/2+x(177)+(Number(i[x(197)])||0)/2+x(227)+(Number(i[x(212)])||0)/2+x(226)+(Number(i.layoutColumnGap)||0)/2+`mm;
|
|
12
|
-
}
|
|
13
|
-
</style>`):p[x(191)](x(225)+(Number(i[x(212)])||0)/2+"mm -"+(Number(i[x(197)])||0)/2+x(227)+(Number(i.layoutRowGap)||0)/2+"mm "+(Number(i[x(197)])||0)/2+x(186));for(let r=0;r<s;r++){const N=globalThis.$(x(178)+t[x(233)]+x(224)+t.paperHeight+x(213)),D=r*_,Y=Math[x(196)]((r+1)*_,y);for(let R=D;R<Y;R++){const G=d.eq(R)[x(189)]();G.removeClass(x(246)),G[x(217)](x(214)+R);const V=globalThis.$('<div class="hiprint-printPanel-small"></div>');V[x(191)](G),N[x(202)](x(201)).append(V)}p[x(191)](N)}this[x(167)](p,u),C[x(211)](p[0]),globalThis.$(p)[x(244)](x(168))}else this[x(167)](g,u),C[x(211)](g[0]),globalThis.$(g)[x(244)](x(168));let k=C[x(202)](x(243))[x(238)];this[x(199)](g,function(){const l=x;try{C[l(202)](l(243)).each(function(h,_){const d=l;globalThis[d(171)][d(232)].add(function(y){const s=d;z.snapdom.toCanvas(_,u)[s(198)](function(p){const r=s;var N=p[r(234)]("2d");N[r(193)]=![];var D=p[r(182)](r(192),u.quality||.92);w[r(169)](D,r(195),0,0,m,O),h<k-1&&w[r(190)](),f(h+1,k),y()})[s(174)](p=>{throw new Error(p.message)})}),h==k-1&&(globalThis[d(171)].queue[d(206)](function(y){const s=d;if(I)o.removeTempContainer(),w[s(221)](t[s(236)]);else{o.removeTempContainer();let p=t[s(204)]||"blob",r=w[s(172)](p);c[s(229)](r)}globalThis[s(171)][s(232)].clear()}),globalThis.hinnn.queue.run())})}catch(h){console[l(209)](l(175)),console[l(230)](h)}})}return c[x(210)]()})};function q(){const n=["870396MNVKbV","type","scale","add","paperHeight","paperType","error","promise","html","layoutRowGap",`mm;"></div>
|
|
14
|
-
</div>`,"hiprint-printPaper-small start-","817870sRwNtd","floor","addClass","panelLayoutOptions","portrait","cur","save","36393lfxVEX","\u81EA\u5B9A\u4E49","mm;height:",`<style>
|
|
15
|
-
.hiprint-printPanel-small{
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
border: 0px;
|
|
18
|
-
}
|
|
19
|
-
.hiprint-printPaper-small{
|
|
20
|
-
position: relative;
|
|
21
|
-
padding: 0;
|
|
22
|
-
}
|
|
23
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-wrap: wrap;
|
|
26
|
-
flex-direction: column;
|
|
27
|
-
align-content: flex-start;
|
|
28
|
-
margin: -`,"mm ",`mm;
|
|
29
|
-
}
|
|
30
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
31
|
-
display:inline-block;
|
|
32
|
-
padding: `,"printPanels","resolve","log","465JYscVO","queue","paperWidth","getContext","1830570nhlfoR","name","isDownload","length","toLocaleLowerCase","453RnbkRT","extend","824JuXcAV",".hiprint-printPanel .hiprint-printPaper","css","createTempContainer","hiprint-printPaper","57762hBjdeZ","row","svg2canvas","position:fixed","addImage",'<div class="hiprint-printTemplate"></div>',"hinnn","output","height","catch","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","layoutType","mm -",`<div class="hiprint-printPanel">
|
|
33
|
-
<div class="hiprint-printPaper" style="width:`,"width","toPt","now","toDataURL","indexOf","21820PdnyNC","11739024gYkaDO",`mm;
|
|
34
|
-
}
|
|
35
|
-
</style>`,".pdf","pixelRatio","clone","addPage","append","image/jpeg","imageSmoothingEnabled","dpr","JPEG","min","layoutColumnGap","then","loadAllImages","onProgress",".hiprint-printPaper","find"];return q=function(){return n},q()}(function(n,a){for(var e=M,x=n();[];)try{var o=parseInt(e(491))/1*(-parseInt(e(490))/2)+parseInt(e(495))/3+-parseInt(e(487))/4+parseInt(e(484))/5*(parseInt(e(494))/6)+-parseInt(e(493))/7*(parseInt(e(488))/8)+-parseInt(e(497))/9+parseInt(e(485))/10;if(o===a)break;x.push(x.shift())}catch(c){x.push(x.shift())}})($,444814);function M(n,a){var e=$();return M=function(x,o){x=x-484;var c=e[x];return c},M(n,a)}function $(){var n=["11800220KdCSqW","add toPdf Api to PrintTemplate","149712dcKDWM","36112hbQYCs","toPdf","31846ymriPr","23eWdTxC","newPrintTemplate","602uMlddO","44490VKEqul","1166520yrTloY","add toPdf Api","5859288JZXlPB","215YCzUPc"];return $=function(){return n},$()}function K(n){var a=M;return{name:a(496),description:a(496),hooks:[{hook:a(492),name:a(486),description:a(486),priority:1,run:({template:e,options:x})=>{var o=a;Object.defineProperty(e,o(489),{value:J,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}module.exports=K;
|
|
1
|
+
"use strict";var k=(a,n,e)=>new Promise((x,r)=>{var p=t=>{try{l(e.next(t))}catch(f){r(f)}},m=t=>{try{l(e.throw(t))}catch(f){r(f)}},l=t=>t.done?x(t.value):Promise.resolve(t.value).then(p,m);l((e=e.apply(a,n)).next())});const B=require("@zumer/snapdom"),H=require("jspdf");(function(a,n){const e=q,x=a();for(;;)try{if(-parseInt(e(364))/1*(-parseInt(e(353))/2)+-parseInt(e(341))/3*(parseInt(e(378))/4)+parseInt(e(347))/5+parseInt(e(351))/6*(parseInt(e(369))/7)+parseInt(e(371))/8+-parseInt(e(374))/9+-parseInt(e(352))/10*(parseInt(e(334))/11)===n)break;x.push(x.shift())}catch(r){x.push(x.shift())}})(w,319677);const W=function(a,n,e){return k(this,null,function*(){const x=q;var r=this,p=globalThis.$[x(340)](),m=!0;let l=(P,T)=>{const c=x,d=Math[c(361)](P/T*100);console[c(319)](c(377),P,"total",T),console[c(319)](c(372),d+"%")},t=e||{};if(this[x(382)][x(327)]){if(typeof n===x(375)){const o=n[x(367)](x(365))>-1?n:n+x(365);t[x(360)]=o}else t=n||{},!t[x(360)]&&(t.name=x(362)+Date[x(344)]()+x(365));let P=this[x(382)][0][x(333)],T=this[x(382)][0][x(348)];const c=t[x(343)]&&t[x(330)];var f=globalThis[x(363)].mm[x(323)](t[x(343)]||P),C=globalThis.hinnn.mm[x(323)](t[x(330)]||T),u=globalThis.$[x(338)]({backgroundColor:x(329)},t||{});const d=this[x(382)][0][x(335)],R=d!=null&&d!=""&&d!=x(376),X=this[x(321)](0)==1||c?x(328):"landscape",E=R&&!c?d[x(332)]():[f,C];var v=new H.jsPDF({orientation:X,unit:"pt",format:E}),_=yield this.getHtml(a,t);t&&(t[x(326)]&&(u[x(346)]=t.pixelRatio,u[x(368)]=t[x(326)]),t[x(379)]!=null&&(m=t[x(379)]),t[x(336)]!=null&&(l=t[x(336)])),globalThis.$(_)[x(355)]("width","")[x(355)](x(348),""),this[x(325)]();var I=this[x(342)]();this[x(331)](_,u),I[x(337)](_[0]),globalThis.$(_)[x(355)](x(324));let A=I[x(354)](x(381)).length;this[x(370)](I,function(){const o=x;try{I[o(354)](o(381))[o(345)](function(b,G){const i=o;globalThis[i(363)][i(322)][i(358)](function(j){const s=i;B.snapdom.toCanvas(G,u)[s(318)](function(h){const g=s;var O=h[g(366)]("2d");O[g(356)]=!1;var Z=h.toDataURL("image/jpeg",u.quality||.92);v.addImage(Z,g(320),0,0,f,C),b<A-1&&v.addPage(),l(b+1,A),j()})[s(350)](h=>{throw new Error(h.message)})}),b==A-1&&(globalThis.hinnn.queue[i(358)](function(j){const s=i;if(m)r.removeTempContainer(),v[s(349)](t[s(360)]);else{r[s(359)]();let h=t[s(373)]||"blob",g=v.output(h);p.resolve(g)}globalThis[s(363)].queue.clear()}),globalThis[i(363)][i(322)][i(380)]())})}catch(b){console[o(339)](o(357)),console[o(319)](b)}})}return p.promise()})};function q(a,n){const e=w();return q=function(x,r){return x=x-318,e[x]},q(a,n)}function w(){const a=["save","catch","1270116jXYvDl","10isvtQq","134FXOcys","find","css","imageSmoothingEnabled","toPdf 失败(可能您的图片资源无法正常加载): ","add","removeTempContainer","name","floor","sv-print-","hinnn","2913lJqTSb",".pdf","getContext","indexOf","scale","7ephwfs","loadAllImages","2436640DEXpzD","toPdf percent: ","type","4154787eMEquO","string","自定义","cur","11468BswBuP","isDownload","run",".hiprint-printPanel .hiprint-printPaper","printPanels","then","log","JPEG","getOrient","queue","toPt","position:fixed","createTempContainer","pixelRatio","length","portrait","#fff","paperHeight","svg2canvas","toLocaleLowerCase","width","565334qhgZZz","paperType","onProgress","html","extend","error","Deferred","183uXkDZV","getTempContainer","paperWidth","now","each","dpr","1480820qWimoZ","height"];return w=function(){return a},w()}function y(){var a=["2979GBpDqr","add toPdf Api","4575935rhWZqJ","918DcynHl","toPdf","1523658KGpjTG","defineProperty","1531140yqUKYr","46392ARDXSt","230qAbAyB","newPrintTemplate","5242002lfWGRM","2950684ipXaaP","5TaYwDD","0.3.0","add toPdf Api to PrintTemplate","176VhqARN"];return y=function(){return a},y()}(function(a,n){for(var e=D,x=a();;)try{var r=-parseInt(e(324))/1*(parseInt(e(316))/2)+-parseInt(e(329))/3+-parseInt(e(319))/4+-parseInt(e(320))/5*(-parseInt(e(318))/6)+-parseInt(e(326))/7+parseInt(e(315))/8*(-parseInt(e(327))/9)+-parseInt(e(314))/10*(-parseInt(e(323))/11);if(r===n)break;x.push(x.shift())}catch(p){x.push(x.shift())}})(y,490146);function D(a,n){var e=y();return D=function(x,r){x=x-314;var p=e[x];return p},D(a,n)}function $(a){var n=D;return{name:n(325),description:"add toPdf Api",hooks:[{hook:n(317),name:n(322),description:n(322),priority:1,run:({template:e,options:x})=>{var r=n;Object[r(330)](e,r(328),{value:W,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(321)}}module.exports=$;
|
package/dist/index.mjs
CHANGED
|
@@ -1,185 +1,131 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var R = (a, n, t) => new Promise((x, r) => {
|
|
2
|
+
var p = (e) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
4
|
+
c(t.next(e));
|
|
5
|
+
} catch (f) {
|
|
6
|
+
r(f);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, m = (e) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
10
|
+
c(t.throw(e));
|
|
11
|
+
} catch (f) {
|
|
12
|
+
r(f);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, c = (e) => e.done ? x(e.value) : Promise.resolve(e.value).then(p, m);
|
|
15
|
+
c((t = t.apply(a, n)).next());
|
|
16
16
|
});
|
|
17
|
-
import { snapdom as
|
|
18
|
-
import { jsPDF as
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
return x = x - 167, e[x];
|
|
23
|
-
}, T(n, a);
|
|
24
|
-
}
|
|
25
|
-
(function(n, a) {
|
|
26
|
-
const e = T, x = n();
|
|
27
|
-
for (; []; )
|
|
17
|
+
import { snapdom as B } from "@zumer/snapdom";
|
|
18
|
+
import { jsPDF as H } from "jspdf";
|
|
19
|
+
(function(a, n) {
|
|
20
|
+
const t = w, x = a();
|
|
21
|
+
for (; ; )
|
|
28
22
|
try {
|
|
29
|
-
if (parseInt(
|
|
30
|
-
break;
|
|
23
|
+
if (-parseInt(t(364)) / 1 * (-parseInt(t(353)) / 2) + -parseInt(t(341)) / 3 * (parseInt(t(378)) / 4) + parseInt(t(347)) / 5 + parseInt(t(351)) / 6 * (parseInt(t(369)) / 7) + parseInt(t(371)) / 8 + -parseInt(t(374)) / 9 + -parseInt(t(352)) / 10 * (parseInt(t(334)) / 11) === n) break;
|
|
31
24
|
x.push(x.shift());
|
|
32
|
-
} catch (
|
|
25
|
+
} catch (r) {
|
|
33
26
|
x.push(x.shift());
|
|
34
27
|
}
|
|
35
|
-
})(
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
const x =
|
|
39
|
-
var
|
|
40
|
-
let
|
|
41
|
-
const
|
|
42
|
-
console[
|
|
43
|
-
},
|
|
44
|
-
if (this[x(
|
|
45
|
-
if (typeof
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
} else
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
const
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
i[x(176)] == x(248) ? s.append(`<style>
|
|
61
|
-
.hiprint-printPanel-small{
|
|
62
|
-
box-sizing: border-box;
|
|
63
|
-
border: 0px;
|
|
64
|
-
}
|
|
65
|
-
.hiprint-printPaper-small{
|
|
66
|
-
position: relative;
|
|
67
|
-
padding: 0;
|
|
68
|
-
}
|
|
69
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
70
|
-
margin: -` + (Number(i[x(212)]) || 0) / 2 + x(177) + (Number(i[x(197)]) || 0) / 2 + x(227) + (Number(i[x(212)]) || 0) / 2 + x(226) + (Number(i.layoutColumnGap) || 0) / 2 + `mm;
|
|
71
|
-
}
|
|
72
|
-
</style>`) : s[x(191)](x(225) + (Number(i[x(212)]) || 0) / 2 + "mm -" + (Number(i[x(197)]) || 0) / 2 + x(227) + (Number(i.layoutRowGap) || 0) / 2 + "mm " + (Number(i[x(197)]) || 0) / 2 + x(186));
|
|
73
|
-
for (let r = 0; r < p; r++) {
|
|
74
|
-
const N = globalThis.$(x(178) + t[x(233)] + x(224) + t.paperHeight + x(213)), D = r * _, j = Math[x(196)]((r + 1) * _, y);
|
|
75
|
-
for (let R = D; R < j; R++) {
|
|
76
|
-
const G = d.eq(R)[x(189)]();
|
|
77
|
-
G.removeClass(x(246)), G[x(217)](x(214) + R);
|
|
78
|
-
const V = globalThis.$('<div class="hiprint-printPanel-small"></div>');
|
|
79
|
-
V[x(191)](G), N[x(202)](x(201)).append(V);
|
|
80
|
-
}
|
|
81
|
-
s[x(191)](N);
|
|
82
|
-
}
|
|
83
|
-
this[x(167)](s, u), C[x(211)](s[0]), globalThis.$(s)[x(244)](x(168));
|
|
84
|
-
} else
|
|
85
|
-
this[x(167)](g, u), C[x(211)](g[0]), globalThis.$(g)[x(244)](x(168));
|
|
86
|
-
let q = C[x(202)](x(243))[x(238)];
|
|
87
|
-
this[x(199)](g, function() {
|
|
88
|
-
const l = x;
|
|
28
|
+
})(q, 319677);
|
|
29
|
+
const W = function(a, n, t) {
|
|
30
|
+
return R(this, null, function* () {
|
|
31
|
+
const x = w;
|
|
32
|
+
var r = this, p = globalThis.$[x(340)](), m = !0;
|
|
33
|
+
let c = (P, T) => {
|
|
34
|
+
const l = x, h = Math[l(361)](P / T * 100);
|
|
35
|
+
console[l(319)](l(377), P, "total", T), console[l(319)](l(372), h + "%");
|
|
36
|
+
}, e = t || {};
|
|
37
|
+
if (this[x(382)][x(327)]) {
|
|
38
|
+
if (typeof n === x(375)) {
|
|
39
|
+
const o = n[x(367)](x(365)) > -1 ? n : n + x(365);
|
|
40
|
+
e[x(360)] = o;
|
|
41
|
+
} else e = n || {}, !e[x(360)] && (e.name = x(362) + Date[x(344)]() + x(365));
|
|
42
|
+
let P = this[x(382)][0][x(333)], T = this[x(382)][0][x(348)];
|
|
43
|
+
const l = e[x(343)] && e[x(330)];
|
|
44
|
+
var f = globalThis[x(363)].mm[x(323)](e[x(343)] || P), C = globalThis.hinnn.mm[x(323)](e[x(330)] || T), u = globalThis.$[x(338)]({ backgroundColor: x(329) }, e || {});
|
|
45
|
+
const h = this[x(382)][0][x(335)], X = h != null && h != "" && h != x(376), j = this[x(321)](0) == 1 || l ? x(328) : "landscape", E = X && !l ? h[x(332)]() : [f, C];
|
|
46
|
+
var v = new H({ orientation: j, unit: "pt", format: E }), _ = yield this.getHtml(a, e);
|
|
47
|
+
e && (e[x(326)] && (u[x(346)] = e.pixelRatio, u[x(368)] = e[x(326)]), e[x(379)] != null && (m = e[x(379)]), e[x(336)] != null && (c = e[x(336)])), globalThis.$(_)[x(355)]("width", "")[x(355)](x(348), ""), this[x(325)]();
|
|
48
|
+
var I = this[x(342)]();
|
|
49
|
+
this[x(331)](_, u), I[x(337)](_[0]), globalThis.$(_)[x(355)](x(324));
|
|
50
|
+
let A = I[x(354)](x(381)).length;
|
|
51
|
+
this[x(370)](I, function() {
|
|
52
|
+
const o = x;
|
|
89
53
|
try {
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
globalThis[
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
})[
|
|
101
|
-
throw new Error(
|
|
54
|
+
I[o(354)](o(381))[o(345)](function(b, G) {
|
|
55
|
+
const i = o;
|
|
56
|
+
globalThis[i(363)][i(322)][i(358)](function(k) {
|
|
57
|
+
const s = i;
|
|
58
|
+
B.toCanvas(G, u)[s(318)](function(d) {
|
|
59
|
+
const g = s;
|
|
60
|
+
var O = d[g(366)]("2d");
|
|
61
|
+
O[g(356)] = !1;
|
|
62
|
+
var Z = d.toDataURL("image/jpeg", u.quality || 0.92);
|
|
63
|
+
v.addImage(Z, g(320), 0, 0, f, C), b < A - 1 && v.addPage(), c(b + 1, A), k();
|
|
64
|
+
})[s(350)]((d) => {
|
|
65
|
+
throw new Error(d.message);
|
|
102
66
|
});
|
|
103
|
-
}),
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
o.removeTempContainer(), w[p(221)](t[p(236)]);
|
|
67
|
+
}), b == A - 1 && (globalThis.hinnn.queue[i(358)](function(k) {
|
|
68
|
+
const s = i;
|
|
69
|
+
if (m) r.removeTempContainer(), v[s(349)](e[s(360)]);
|
|
107
70
|
else {
|
|
108
|
-
|
|
109
|
-
let
|
|
110
|
-
|
|
71
|
+
r[s(359)]();
|
|
72
|
+
let d = e[s(373)] || "blob", g = v.output(d);
|
|
73
|
+
p.resolve(g);
|
|
111
74
|
}
|
|
112
|
-
globalThis[
|
|
113
|
-
}), globalThis
|
|
75
|
+
globalThis[s(363)].queue.clear();
|
|
76
|
+
}), globalThis[i(363)][i(322)][i(380)]());
|
|
114
77
|
});
|
|
115
|
-
} catch (
|
|
116
|
-
console[
|
|
78
|
+
} catch (b) {
|
|
79
|
+
console[o(339)](o(357)), console[o(319)](b);
|
|
117
80
|
}
|
|
118
81
|
});
|
|
119
82
|
}
|
|
120
|
-
return
|
|
83
|
+
return p.promise();
|
|
121
84
|
});
|
|
122
85
|
};
|
|
123
|
-
function
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
135
|
-
display: flex;
|
|
136
|
-
flex-wrap: wrap;
|
|
137
|
-
flex-direction: column;
|
|
138
|
-
align-content: flex-start;
|
|
139
|
-
margin: -`, "mm ", `mm;
|
|
140
|
-
}
|
|
141
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
142
|
-
display:inline-block;
|
|
143
|
-
padding: `, "printPanels", "resolve", "log", "465JYscVO", "queue", "paperWidth", "getContext", "1830570nhlfoR", "name", "isDownload", "length", "toLocaleLowerCase", "453RnbkRT", "extend", "824JuXcAV", ".hiprint-printPanel .hiprint-printPaper", "css", "createTempContainer", "hiprint-printPaper", "57762hBjdeZ", "row", "svg2canvas", "position:fixed", "addImage", '<div class="hiprint-printTemplate"></div>', "hinnn", "output", "height", "catch", "toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "layoutType", "mm -", `<div class="hiprint-printPanel">
|
|
144
|
-
<div class="hiprint-printPaper" style="width:`, "width", "toPt", "now", "toDataURL", "indexOf", "21820PdnyNC", "11739024gYkaDO", `mm;
|
|
145
|
-
}
|
|
146
|
-
</style>`, ".pdf", "pixelRatio", "clone", "addPage", "append", "image/jpeg", "imageSmoothingEnabled", "dpr", "JPEG", "min", "layoutColumnGap", "then", "loadAllImages", "onProgress", ".hiprint-printPaper", "find"];
|
|
147
|
-
return M = function() {
|
|
148
|
-
return n;
|
|
149
|
-
}, M();
|
|
86
|
+
function w(a, n) {
|
|
87
|
+
const t = q();
|
|
88
|
+
return w = function(x, r) {
|
|
89
|
+
return x = x - 318, t[x];
|
|
90
|
+
}, w(a, n);
|
|
91
|
+
}
|
|
92
|
+
function q() {
|
|
93
|
+
const a = ["save", "catch", "1270116jXYvDl", "10isvtQq", "134FXOcys", "find", "css", "imageSmoothingEnabled", "toPdf 失败(可能您的图片资源无法正常加载): ", "add", "removeTempContainer", "name", "floor", "sv-print-", "hinnn", "2913lJqTSb", ".pdf", "getContext", "indexOf", "scale", "7ephwfs", "loadAllImages", "2436640DEXpzD", "toPdf percent: ", "type", "4154787eMEquO", "string", "自定义", "cur", "11468BswBuP", "isDownload", "run", ".hiprint-printPanel .hiprint-printPaper", "printPanels", "then", "log", "JPEG", "getOrient", "queue", "toPt", "position:fixed", "createTempContainer", "pixelRatio", "length", "portrait", "#fff", "paperHeight", "svg2canvas", "toLocaleLowerCase", "width", "565334qhgZZz", "paperType", "onProgress", "html", "extend", "error", "Deferred", "183uXkDZV", "getTempContainer", "paperWidth", "now", "each", "dpr", "1480820qWimoZ", "height"];
|
|
94
|
+
return q = function() {
|
|
95
|
+
return a;
|
|
96
|
+
}, q();
|
|
150
97
|
}
|
|
151
|
-
|
|
152
|
-
|
|
98
|
+
function y() {
|
|
99
|
+
var a = ["2979GBpDqr", "add toPdf Api", "4575935rhWZqJ", "918DcynHl", "toPdf", "1523658KGpjTG", "defineProperty", "1531140yqUKYr", "46392ARDXSt", "230qAbAyB", "newPrintTemplate", "5242002lfWGRM", "2950684ipXaaP", "5TaYwDD", "0.3.0", "add toPdf Api to PrintTemplate", "176VhqARN"];
|
|
100
|
+
return y = function() {
|
|
101
|
+
return a;
|
|
102
|
+
}, y();
|
|
103
|
+
}
|
|
104
|
+
(function(a, n) {
|
|
105
|
+
for (var t = D, x = a(); ; )
|
|
153
106
|
try {
|
|
154
|
-
var
|
|
155
|
-
if (
|
|
156
|
-
break;
|
|
107
|
+
var r = -parseInt(t(324)) / 1 * (parseInt(t(316)) / 2) + -parseInt(t(329)) / 3 + -parseInt(t(319)) / 4 + -parseInt(t(320)) / 5 * (-parseInt(t(318)) / 6) + -parseInt(t(326)) / 7 + parseInt(t(315)) / 8 * (-parseInt(t(327)) / 9) + -parseInt(t(314)) / 10 * (-parseInt(t(323)) / 11);
|
|
108
|
+
if (r === n) break;
|
|
157
109
|
x.push(x.shift());
|
|
158
|
-
} catch (
|
|
110
|
+
} catch (p) {
|
|
159
111
|
x.push(x.shift());
|
|
160
112
|
}
|
|
161
|
-
})(
|
|
162
|
-
function
|
|
163
|
-
var
|
|
164
|
-
return
|
|
165
|
-
x = x -
|
|
166
|
-
var
|
|
167
|
-
return
|
|
168
|
-
},
|
|
169
|
-
}
|
|
170
|
-
function k() {
|
|
171
|
-
var n = ["11800220KdCSqW", "add toPdf Api to PrintTemplate", "149712dcKDWM", "36112hbQYCs", "toPdf", "31846ymriPr", "23eWdTxC", "newPrintTemplate", "602uMlddO", "44490VKEqul", "1166520yrTloY", "add toPdf Api", "5859288JZXlPB", "215YCzUPc"];
|
|
172
|
-
return k = function() {
|
|
173
|
-
return n;
|
|
174
|
-
}, k();
|
|
113
|
+
})(y, 490146);
|
|
114
|
+
function D(a, n) {
|
|
115
|
+
var t = y();
|
|
116
|
+
return D = function(x, r) {
|
|
117
|
+
x = x - 314;
|
|
118
|
+
var p = t[x];
|
|
119
|
+
return p;
|
|
120
|
+
}, D(a, n);
|
|
175
121
|
}
|
|
176
|
-
function
|
|
177
|
-
var
|
|
178
|
-
return { name:
|
|
179
|
-
var
|
|
180
|
-
Object
|
|
181
|
-
} }], leastHiprintVersion:
|
|
122
|
+
function M(a) {
|
|
123
|
+
var n = D;
|
|
124
|
+
return { name: n(325), description: "add toPdf Api", hooks: [{ hook: n(317), name: n(322), description: n(322), priority: 1, run: ({ template: t, options: x }) => {
|
|
125
|
+
var r = n;
|
|
126
|
+
Object[r(330)](t, r(328), { value: W, enumerable: !1, writable: !0, configurable: !0 });
|
|
127
|
+
} }], leastHiprintVersion: n(321) };
|
|
182
128
|
}
|
|
183
129
|
export {
|
|
184
|
-
|
|
130
|
+
M as default
|
|
185
131
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,35 +1 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
.hiprint-printPanel-small{
|
|
3
|
-
box-sizing: border-box;
|
|
4
|
-
border: 0px;
|
|
5
|
-
}
|
|
6
|
-
.hiprint-printPaper-small{
|
|
7
|
-
position: relative;
|
|
8
|
-
padding: 0;
|
|
9
|
-
}
|
|
10
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
11
|
-
margin: -`+(Number(i[x(212)])||0)/2+x(177)+(Number(i[x(197)])||0)/2+x(227)+(Number(i[x(212)])||0)/2+x(226)+(Number(i.layoutColumnGap)||0)/2+`mm;
|
|
12
|
-
}
|
|
13
|
-
</style>`):p[x(191)](x(225)+(Number(i[x(212)])||0)/2+"mm -"+(Number(i[x(197)])||0)/2+x(227)+(Number(i.layoutRowGap)||0)/2+"mm "+(Number(i[x(197)])||0)/2+x(186));for(let r=0;r<o;r++){const j=globalThis.$(x(178)+n[x(233)]+x(224)+n.paperHeight+x(213)),D=r*C,K=Math[x(196)]((r+1)*C,N);for(let M=D;M<K;M++){const G=f.eq(M)[x(189)]();G.removeClass(x(246)),G[x(217)](x(214)+M);const E=globalThis.$('<div class="hiprint-printPanel-small"></div>');E[x(191)](G),j[x(202)](x(201)).append(E)}p[x(191)](j)}this[x(167)](p,_),q[x(211)](p[0]),globalThis.$(p)[x(244)](x(168))}else this[x(167)](y,_),q[x(211)](y[0]),globalThis.$(y)[x(244)](x(168));let k=q[x(202)](x(243))[x(238)];this[x(199)](y,function(){const d=x;try{q[d(202)](d(243)).each(function(m,C){const f=d;globalThis[f(171)][f(232)].add(function(N){const o=f;c.snapdom.toCanvas(C,_)[o(198)](function(p){const r=o;var j=p[r(234)]("2d");j[r(193)]=![];var D=p[r(182)](r(192),_.quality||.92);R[r(169)](D,r(195),0,0,z,A),m<k-1&&R[r(190)](),V(m+1,k),N()})[o(174)](p=>{throw new Error(p.message)})}),m==k-1&&(globalThis[f(171)].queue[f(206)](function(N){const o=f;if(O)l.removeTempContainer(),R[o(221)](n[o(236)]);else{l.removeTempContainer();let p=n[o(204)]||"blob",r=R[o(172)](p);v[o(229)](r)}globalThis[o(171)][o(232)].clear()}),globalThis.hinnn.queue.run())})}catch(m){console[d(209)](d(175)),console[d(230)](m)}})}return v[x(210)]()})};function u(){const a=["870396MNVKbV","type","scale","add","paperHeight","paperType","error","promise","html","layoutRowGap",`mm;"></div>
|
|
14
|
-
</div>`,"hiprint-printPaper-small start-","817870sRwNtd","floor","addClass","panelLayoutOptions","portrait","cur","save","36393lfxVEX","\u81EA\u5B9A\u4E49","mm;height:",`<style>
|
|
15
|
-
.hiprint-printPanel-small{
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
border: 0px;
|
|
18
|
-
}
|
|
19
|
-
.hiprint-printPaper-small{
|
|
20
|
-
position: relative;
|
|
21
|
-
padding: 0;
|
|
22
|
-
}
|
|
23
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-wrap: wrap;
|
|
26
|
-
flex-direction: column;
|
|
27
|
-
align-content: flex-start;
|
|
28
|
-
margin: -`,"mm ",`mm;
|
|
29
|
-
}
|
|
30
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
31
|
-
display:inline-block;
|
|
32
|
-
padding: `,"printPanels","resolve","log","465JYscVO","queue","paperWidth","getContext","1830570nhlfoR","name","isDownload","length","toLocaleLowerCase","453RnbkRT","extend","824JuXcAV",".hiprint-printPanel .hiprint-printPaper","css","createTempContainer","hiprint-printPaper","57762hBjdeZ","row","svg2canvas","position:fixed","addImage",'<div class="hiprint-printTemplate"></div>',"hinnn","output","height","catch","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","layoutType","mm -",`<div class="hiprint-printPanel">
|
|
33
|
-
<div class="hiprint-printPaper" style="width:`,"width","toPt","now","toDataURL","indexOf","21820PdnyNC","11739024gYkaDO",`mm;
|
|
34
|
-
}
|
|
35
|
-
</style>`,".pdf","pixelRatio","clone","addPage","append","image/jpeg","imageSmoothingEnabled","dpr","JPEG","min","layoutColumnGap","then","loadAllImages","onProgress",".hiprint-printPaper","find"];return u=function(){return a},u()}(function(a,t){for(var e=g,x=a();[];)try{var l=parseInt(e(491))/1*(-parseInt(e(490))/2)+parseInt(e(495))/3+-parseInt(e(487))/4+parseInt(e(484))/5*(parseInt(e(494))/6)+-parseInt(e(493))/7*(parseInt(e(488))/8)+-parseInt(e(497))/9+parseInt(e(485))/10;if(l===t)break;x.push(x.shift())}catch(v){x.push(x.shift())}})(P,444814);function g(a,t){var e=P();return g=function(x,l){x=x-484;var v=e[x];return v},g(a,t)}function P(){var a=["11800220KdCSqW","add toPdf Api to PrintTemplate","149712dcKDWM","36112hbQYCs","toPdf","31846ymriPr","23eWdTxC","newPrintTemplate","602uMlddO","44490VKEqul","1166520yrTloY","add toPdf Api","5859288JZXlPB","215YCzUPc"];return P=function(){return a},P()}function T(a){var t=g;return{name:t(496),description:t(496),hooks:[{hook:t(492),name:t(486),description:t(486),priority:1,run:({template:e,options:x})=>{var l=t;Object.defineProperty(e,l(489),{value:$,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}return T});
|
|
1
|
+
(function(r,d){typeof exports=="object"&&typeof module!="undefined"?module.exports=d(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],d):(r=typeof globalThis!="undefined"?globalThis:r||self,r.pluginApiPdf=d(r.window,r.jspdf))})(this,function(r,d){"use strict";var G=(r,d,l)=>new Promise((u,c)=>{var h=n=>{try{_(l.next(n))}catch(t){c(t)}},b=n=>{try{_(l.throw(n))}catch(t){c(t)}},_=n=>n.done?u(n.value):Promise.resolve(n.value).then(h,b);_((l=l.apply(r,d)).next())});(function(n,t){const x=u,e=n();for(;;)try{if(-parseInt(x(364))/1*(-parseInt(x(353))/2)+-parseInt(x(341))/3*(parseInt(x(378))/4)+parseInt(x(347))/5+parseInt(x(351))/6*(parseInt(x(369))/7)+parseInt(x(371))/8+-parseInt(x(374))/9+-parseInt(x(352))/10*(parseInt(x(334))/11)===t)break;e.push(e.shift())}catch(i){e.push(e.shift())}})(c,319677);const l=function(n,t,x){return G(this,null,function*(){const e=u;var i=this,m=globalThis.$[e(340)](),C=!0;let k=(D,j)=>{const f=e,g=Math[f(361)](D/j*100);console[f(319)](f(377),D,"total",j),console[f(319)](f(372),g+"%")},a=x||{};if(this[e(382)][e(327)]){if(typeof t===e(375)){const o=t[e(367)](e(365))>-1?t:t+e(365);a[e(360)]=o}else a=t||{},!a[e(360)]&&(a.name=e(362)+Date[e(344)]()+e(365));let D=this[e(382)][0][e(333)],j=this[e(382)][0][e(348)];const f=a[e(343)]&&a[e(330)];var R=globalThis[e(363)].mm[e(323)](a[e(343)]||D),X=globalThis.hinnn.mm[e(323)](a[e(330)]||j),I=globalThis.$[e(338)]({backgroundColor:e(329)},a||{});const g=this[e(382)][0][e(335)],O=g!=null&&g!=""&&g!=e(376),Z=this[e(321)](0)==1||f?e(328):"landscape",z=O&&!f?g[e(332)]():[R,X];var w=new d.jsPDF({orientation:Z,unit:"pt",format:z}),q=yield this.getHtml(n,a);a&&(a[e(326)]&&(I[e(346)]=a.pixelRatio,I[e(368)]=a[e(326)]),a[e(379)]!=null&&(C=a[e(379)]),a[e(336)]!=null&&(k=a[e(336)])),globalThis.$(q)[e(355)]("width","")[e(355)](e(348),""),this[e(325)]();var y=this[e(342)]();this[e(331)](q,I),y[e(337)](q[0]),globalThis.$(q)[e(355)](e(324));let A=y[e(354)](e(381)).length;this[e(370)](y,function(){const o=e;try{y[o(354)](o(381))[o(345)](function(T,B){const s=o;globalThis[s(363)][s(322)][s(358)](function(E){const p=s;r.snapdom.toCanvas(B,I)[p(318)](function(v){const P=p;var H=v[P(366)]("2d");H[P(356)]=!1;var W=v.toDataURL("image/jpeg",I.quality||.92);w.addImage(W,P(320),0,0,R,X),T<A-1&&w.addPage(),k(T+1,A),E()})[p(350)](v=>{throw new Error(v.message)})}),T==A-1&&(globalThis.hinnn.queue[s(358)](function(E){const p=s;if(C)i.removeTempContainer(),w[p(349)](a[p(360)]);else{i[p(359)]();let v=a[p(373)]||"blob",P=w.output(v);m.resolve(P)}globalThis[p(363)].queue.clear()}),globalThis[s(363)][s(322)][s(380)]())})}catch(T){console[o(339)](o(357)),console[o(319)](T)}})}return m.promise()})};function u(n,t){const x=c();return u=function(e,i){return e=e-318,x[e]},u(n,t)}function c(){const n=["save","catch","1270116jXYvDl","10isvtQq","134FXOcys","find","css","imageSmoothingEnabled","toPdf 失败(可能您的图片资源无法正常加载): ","add","removeTempContainer","name","floor","sv-print-","hinnn","2913lJqTSb",".pdf","getContext","indexOf","scale","7ephwfs","loadAllImages","2436640DEXpzD","toPdf percent: ","type","4154787eMEquO","string","自定义","cur","11468BswBuP","isDownload","run",".hiprint-printPanel .hiprint-printPaper","printPanels","then","log","JPEG","getOrient","queue","toPt","position:fixed","createTempContainer","pixelRatio","length","portrait","#fff","paperHeight","svg2canvas","toLocaleLowerCase","width","565334qhgZZz","paperType","onProgress","html","extend","error","Deferred","183uXkDZV","getTempContainer","paperWidth","now","each","dpr","1480820qWimoZ","height"];return c=function(){return n},c()}function h(){var n=["2979GBpDqr","add toPdf Api","4575935rhWZqJ","918DcynHl","toPdf","1523658KGpjTG","defineProperty","1531140yqUKYr","46392ARDXSt","230qAbAyB","newPrintTemplate","5242002lfWGRM","2950684ipXaaP","5TaYwDD","0.3.0","add toPdf Api to PrintTemplate","176VhqARN"];return h=function(){return n},h()}(function(n,t){for(var x=b,e=n();;)try{var i=-parseInt(x(324))/1*(parseInt(x(316))/2)+-parseInt(x(329))/3+-parseInt(x(319))/4+-parseInt(x(320))/5*(-parseInt(x(318))/6)+-parseInt(x(326))/7+parseInt(x(315))/8*(-parseInt(x(327))/9)+-parseInt(x(314))/10*(-parseInt(x(323))/11);if(i===t)break;e.push(e.shift())}catch(m){e.push(e.shift())}})(h,490146);function b(n,t){var x=h();return b=function(e,i){e=e-314;var m=x[e];return m},b(n,t)}function _(n){var t=b;return{name:t(325),description:"add toPdf Api",hooks:[{hook:t(317),name:t(322),description:t(322),priority:1,run:({template:x,options:e})=>{var i=t;Object[i(330)](x,i(328),{value:l,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:t(321)}}return _});
|