@sv-print/plugin-api-pdf 0.2.0 → 0.2.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/dist/index.js +9 -11
- package/dist/index.mjs +123 -125
- package/dist/index.umd.js +9 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var L=(
|
|
1
|
+
"use strict";var L=(i,e,a)=>new Promise((x,o)=>{var b=t=>{try{m(a.next(t))}catch(u){o(u)}},w=t=>{try{m(a.throw(t))}catch(u){o(u)}},m=t=>t.done?x(t.value):Promise.resolve(t.value).then(b,w);m((a=a.apply(i,e)).next())});const W=require("@zumer/snapdom"),B=require("jspdf");(function(i,e){const a=I,x=i();for(;[];)try{if(parseInt(a(189))/1+-parseInt(a(195))/2+-parseInt(a(151))/3*(parseInt(a(138))/4)+-parseInt(a(143))/5+-parseInt(a(184))/6*(parseInt(a(177))/7)+-parseInt(a(133))/8+-parseInt(a(201))/9*(-parseInt(a(196))/10)===e)break;x.push(x.shift())}catch(o){x.push(x.shift())}})(k,780489);const E=function(i,e,a){return L(this,null,function*(){const x=I;var o=this,b=globalThis.$.Deferred(),w=!![];let m=(_,P)=>{const d=I,r=Math[d(199)](_/P*100);console.log("cur",_,d(192),P),console[d(156)](d(187),r+"%")},t=a||{};if(this[x(171)][x(174)]){if(typeof e===x(172)){const c=e[x(125)](".pdf")>-1?e:e+x(179);t.name=c}else t=e||{},!t[x(182)]&&(t[x(182)]=x(193)+Date[x(131)]()+".pdf");let _=this[x(171)][0][x(141)],P=this[x(171)][0].height;var u=globalThis.hinnn.mm[x(162)](t[x(175)]||_),J=globalThis[x(140)].mm[x(162)](t[x(153)]||P),f=globalThis.$[x(197)]({},t||{});const d=this[x(171)][0][x(128)],r=this[x(171)][0][x(176)],O=r&&(r[x(132)]>0||r[x(129)]>0),R=d!=null&&d!=""&&d!=x(144);var C=new B.jsPDF({orientation:this[x(161)](0)==1?x(136):x(181),unit:"pt",format:R?d.toLocaleLowerCase():[u,J]}),g=yield this[x(164)](i,t);t&&(t.pixelRatio&&(f.dpr=t[x(198)],f.scale=t[x(198)]),t[x(134)]!=null&&(w=t[x(134)]),t[x(148)]!=null&&(m=t[x(148)])),globalThis.$(g)[x(137)](x(141),"")[x(137)](x(183),""),this[x(194)]();var v=this[x(155)]();if(O&&t[x(175)]&&t[x(153)]){let c=Math[x(199)](t.paperWidth/(_+r.layoutRowGap/2)),h=Math.floor(t[x(153)]/(P+r.layoutColumnGap/2));const T=c*h,l=g[x(139)](x(123)),y=l[x(174)],n=Math[x(120)](y/T);let s=globalThis.$(x(146));r[x(186)]==x(173)?s[x(168)](x(135)+(Number(r[x(132)])||0)/2+x(122)+(Number(r.layoutColumnGap)||0)/2+`mm;
|
|
2
2
|
}
|
|
3
3
|
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
4
|
display:inline-block;
|
|
5
|
-
padding: `+(Number(
|
|
5
|
+
padding: `+(Number(r[x(132)])||0)/2+"mm "+(Number(r.layoutColumnGap)||0)/2+x(185)):s[x(168)](`<style>
|
|
6
6
|
.hiprint-printPanel-small{
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
border: 0px;
|
|
@@ -16,16 +16,15 @@
|
|
|
16
16
|
flex-wrap: wrap;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
align-content: flex-start;
|
|
19
|
-
margin: -`+(Number(
|
|
19
|
+
margin: -`+(Number(r[x(132)])||0)/2+"mm -"+(Number(r[x(129)])||0)/2+x(204)+(Number(r[x(132)])||0)/2+x(157)+(Number(r.layoutColumnGap)||0)/2+x(185));for(let p=0;p<n;p++){const G=globalThis.$(x(152)+t.paperWidth+x(154)+t[x(153)]+x(118)),$=p*T,U=Math.min((p+1)*T,y);for(let N=$;N<U;N++){const q=l.eq(N)[x(150)]();q[x(127)](x(170)),q[x(158)](x(160)+N);const A=globalThis.$('<div class="hiprint-printPanel-small"></div>');A.append(q),G[x(139)](x(178)).append(A)}s.append(G)}this[x(169)](s,f),v[x(145)](s[0]),globalThis.$(s)[x(137)](x(200))}else this.svg2canvas(g,f),v[x(145)](g[0]),globalThis.$(g)[x(137)](x(200));let M=v[x(139)](x(123))[x(174)];this.loadAllImages(v,function(){const c=x;try{v[c(139)](c(123))[c(165)](function(h,T){const l=c;globalThis[l(140)][l(191)][l(119)](function(y){const n=l;W.snapdom[n(147)](T,f)[n(159)](function(s){const p=n;var G=s[p(180)]("2d");G[p(126)]=![];var $=s[p(142)]("image/jpeg",f.quality||.92);C[p(205)]($,"JPEG",0,0,u,J),h<M-1&&C[p(124)](),m(h+1,M),y()})[n(121)](s=>{const p=n;throw new Error(s[p(206)])})}),h==M-1&&(globalThis[l(140)][l(191)][l(119)](function(y){const n=l;if(w)o[n(202)](),C[n(130)](t[n(182)]);else{o[n(202)]();let s=t[n(167)]||"blob",p=C[n(149)](s);b[n(166)](p)}globalThis.hinnn[n(191)][n(203)]()}),globalThis[l(140)].queue.run())})}catch(h){console[c(163)](c(188)),console[c(156)](h)}})}return b[x(190)]()})};function I(i,e){const a=k();return I=function(x,o){return x=x-118,a[x]},I(i,e)}function k(){const i=["clone","6dMscGT",`<div class="hiprint-printPanel">
|
|
20
|
+
<div class="hiprint-printPaper" style="width:`,"paperHeight","mm;height:","getTempContainer","log","mm ","addClass","then","hiprint-printPaper-small start-","getOrient","toPt","error","getHtml","each","resolve","type","append","svg2canvas","hiprint-printPaper","printPanels","string","row","length","paperWidth","panelLayoutOptions","1023631wWoxaT",".hiprint-printPaper",".pdf","getContext","landscape","name","height","30WptyTU",`mm;
|
|
21
|
+
}
|
|
22
|
+
</style>`,"layoutType","toPdf percent: ","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","1168448GPmBDt","promise","queue","total","sv-print-","createTempContainer","2647114kIxruS","1428210JcRIkc","extend","pixelRatio","floor","position:fixed","261MdYkZK","removeTempContainer","clear",`mm;
|
|
20
23
|
}
|
|
21
24
|
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
22
25
|
display:inline-block;
|
|
23
|
-
padding:
|
|
24
|
-
|
|
25
|
-
</style>`);for(let s=0;s<r;s++){const q=globalThis.$(x(143)+t.paperWidth+"mm;height:"+t[x(147)]+x(192)),$=s*_,H=Math.min((s+1)*_,y);for(let G=$;G<H;G++){const D=T.eq(G)[x(136)]();D[x(138)](x(186)),D[x(173)]("hiprint-printPaper-small start-"+G);const z=globalThis.$(x(145));z[x(129)](D),q[x(149)](x(132))[x(129)](z)}o[x(129)](q)}this.svg2canvas(o,u),C[x(200)](o[0]),globalThis.$(o).css(x(164))}else this[x(123)](g,u),C[x(200)](g[0]),globalThis.$(g)[x(148)](x(164));let j=C[x(149)](x(189)).length;this.loadAllImages(g,function(){const d=x;try{C[d(149)](".hiprint-printPanel .hiprint-printPaper").each(function(h,_){const T=d;globalThis.hinnn.queue.add(function(y){const r=b;J.snapdom[r(135)](_,u).then(function(o){const s=r;var q=o[s(153)]("2d");q.imageSmoothingEnabled=![];var $=o[s(162)](s(146),u[s(196)]||.92);w.addImage($,"JPEG",0,0,m,k),h<j-1&&w[s(177)](),f(h+1,j),y()})[r(125)](o=>{const s=r;throw new Error(o[s(190)])})}),h==j-1&&(globalThis.hinnn.queue.add(function(y){const r=b;if(I)p[r(155)](),w[r(166)](t.name);else{p[r(155)]();let o=t[r(128)]||"blob",s=w[r(182)](o);l.resolve(s)}globalThis[r(152)][r(201)][r(188)]()}),globalThis[T(152)][T(201)].run())})}catch(h){console.error(d(154)),console[d(122)](h)}})}return l[x(187)]()})};function M(){const n=["mm -",`mm;
|
|
26
|
-
}
|
|
27
|
-
</style>`,"hiprint-printPaper","promise","clear",".hiprint-printPanel .hiprint-printPaper","message","printPanels",`mm;"></div>
|
|
28
|
-
</div>`,"toPt","sv-print-","now","quality","layoutColumnGap","paperWidth","panelLayoutOptions","html","queue","\u81EA\u5B9A\u4E49","log","svg2canvas","cur","catch","portrait",`<style>
|
|
26
|
+
padding: `,"addImage","message",`mm;"></div>
|
|
27
|
+
</div>`,"add","ceil","catch","mm -",".hiprint-printPanel .hiprint-printPaper","addPage","indexOf","imageSmoothingEnabled","removeClass","paperType","layoutColumnGap","save","now","layoutRowGap","303088jpjeEu","isDownload",`<style>
|
|
29
28
|
.hiprint-printPanel-small{
|
|
30
29
|
box-sizing: border-box;
|
|
31
30
|
border: 0px;
|
|
@@ -35,5 +34,4 @@
|
|
|
35
34
|
padding: 0;
|
|
36
35
|
}
|
|
37
36
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
38
|
-
margin: -`,"
|
|
39
|
-
<div class="hiprint-printPaper" style="width:`,'<div class="hiprint-printTemplate"></div>','<div class="hiprint-printPanel-small"></div>',"image/jpeg","paperHeight","css","find","496410JphQqu","225bzKKfo","hinnn","getContext","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","removeTempContainer","getTempContainer","ceil","toLocaleLowerCase","8150280QDxloM",".pdf","extend","toDataURL","mm ","position:fixed","11KwWWQW","save","height","20217frWypB","106MoILUW","length","row","6224LxddCb","addClass","80Jstxgz","createTempContainer","pixelRatio","addPage","157860aXheQJ","onProgress","indexOf","isDownload","output","width"];return M=function(){return n},M()}(function(n,e){for(var a=W,x=n();[];)try{var p=-parseInt(a(372))/1*(-parseInt(a(378))/2)+-parseInt(a(384))/3*(parseInt(a(382))/4)+-parseInt(a(373))/5*(parseInt(a(385))/6)+parseInt(a(377))/7*(parseInt(a(383))/8)+-parseInt(a(368))/9*(parseInt(a(369))/10)+parseInt(a(374))/11*(parseInt(a(370))/12)+parseInt(a(371))/13;if(p===e)break;x.push(x.shift())}catch(l){x.push(x.shift())}})(N,481406);function N(){var n=["27MOEhSM","2658680YUaTMa","5557548stYncn","16497676NlNbli","11923zUbcJC","37975mfUsZp","11xDpdlH","toPdf","add toPdf Api to PrintTemplate","173243Bcupwv","64wscRfe","newPrintTemplate","defineProperty","add toPdf Api","1557396BomoGG","104eqxYYo","3QWpgdj","606hmxlWr"];return N=function(){return n},N()}function W(n,e){var a=N();return W=function(x,p){x=x-368;var l=a[x];return l},W(n,e)}function A(n){var e=W;return{name:e(381),description:e(381),hooks:[{hook:e(379),name:"add toPdf Api to PrintTemplate",description:e(376),priority:1,run:({template:a,options:x})=>{var p=e;Object[p(380)](a,p(375),{value:U,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}module.exports=A;
|
|
37
|
+
margin: -`,"portrait","css","2985212aXroAw","find","hinnn","width","toDataURL","4722770jKjDwl","\u81EA\u5B9A\u4E49","html",'<div class="hiprint-printTemplate"></div>',"toCanvas","onProgress","output"];return k=function(){return i},k()}(function(i,e){for(var a=D,x=i();[];)try{var o=parseInt(a(285))/1*(-parseInt(a(271))/2)+-parseInt(a(278))/3*(-parseInt(a(274))/4)+parseInt(a(276))/5*(-parseInt(a(270))/6)+-parseInt(a(269))/7*(parseInt(a(281))/8)+parseInt(a(286))/9+-parseInt(a(282))/10+-parseInt(a(279))/11*(-parseInt(a(272))/12);if(o===e)break;x.push(x.shift())}catch(b){x.push(x.shift())}})(j,888198);function j(){var i=["defineProperty","add toPdf Api to PrintTemplate","2723IGOXJN","8021799kZgTqd","101689obIHjr","195666UJaNvt","530sNXPXd","29986056hlVKwJ","0.3.0","2852356gBcZAa","newPrintTemplate","30pJdmwU","toPdf","6DDlCVP","11vOMLVp","add toPdf Api","808UNSBJG","15436410LeGBkC"];return j=function(){return i},j()}function D(i,e){var a=j();return D=function(x,o){x=x-269;var b=a[x];return b},D(i,e)}function H(i){var e=D;return{name:"add toPdf Api",description:e(280),hooks:[{hook:e(275),name:e(284),description:e(284),priority:1,run:({template:a,options:x})=>{var o=e;Object[o(283)](a,o(277),{value:E,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(273)}}module.exports=H;
|
package/dist/index.mjs
CHANGED
|
@@ -1,67 +1,61 @@
|
|
|
1
|
-
var O = (
|
|
2
|
-
var
|
|
1
|
+
var O = (i, e, a) => new Promise((x, o) => {
|
|
2
|
+
var b = (t) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
4
|
+
m(a.next(t));
|
|
5
|
+
} catch (u) {
|
|
6
|
+
o(u);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, w = (t) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
10
|
+
m(a.throw(t));
|
|
11
|
+
} catch (u) {
|
|
12
|
+
o(u);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, m = (t) => t.done ? x(t.value) : Promise.resolve(t.value).then(b, w);
|
|
15
|
+
m((a = a.apply(i, e)).next());
|
|
16
16
|
});
|
|
17
|
-
import { snapdom as
|
|
18
|
-
import { jsPDF as
|
|
19
|
-
(function(
|
|
20
|
-
const a =
|
|
17
|
+
import { snapdom as W } from "@zumer/snapdom";
|
|
18
|
+
import { jsPDF as B } from "jspdf";
|
|
19
|
+
(function(i, e) {
|
|
20
|
+
const a = I, x = i();
|
|
21
21
|
for (; []; )
|
|
22
22
|
try {
|
|
23
|
-
if (parseInt(a(
|
|
23
|
+
if (parseInt(a(189)) / 1 + -parseInt(a(195)) / 2 + -parseInt(a(151)) / 3 * (parseInt(a(138)) / 4) + -parseInt(a(143)) / 5 + -parseInt(a(184)) / 6 * (parseInt(a(177)) / 7) + -parseInt(a(133)) / 8 + -parseInt(a(201)) / 9 * (-parseInt(a(196)) / 10) === e)
|
|
24
24
|
break;
|
|
25
25
|
x.push(x.shift());
|
|
26
|
-
} catch (
|
|
26
|
+
} catch (o) {
|
|
27
27
|
x.push(x.shift());
|
|
28
28
|
}
|
|
29
|
-
})(
|
|
30
|
-
function
|
|
31
|
-
const a = N();
|
|
32
|
-
return b = function(x, p) {
|
|
33
|
-
return x = x - 122, a[x];
|
|
34
|
-
}, b(e, n);
|
|
35
|
-
}
|
|
36
|
-
const U = function(e, n, a) {
|
|
29
|
+
})(k, 780489);
|
|
30
|
+
const E = function(i, e, a) {
|
|
37
31
|
return O(this, null, function* () {
|
|
38
|
-
const x =
|
|
39
|
-
var
|
|
40
|
-
let
|
|
41
|
-
const
|
|
42
|
-
console
|
|
32
|
+
const x = I;
|
|
33
|
+
var o = this, b = globalThis.$.Deferred(), w = !![];
|
|
34
|
+
let m = (_, P) => {
|
|
35
|
+
const d = I, r = Math[d(199)](_ / P * 100);
|
|
36
|
+
console.log("cur", _, d(192), P), console[d(156)](d(187), r + "%");
|
|
43
37
|
}, t = a || {};
|
|
44
|
-
if (this[x(
|
|
45
|
-
if (typeof
|
|
46
|
-
const
|
|
47
|
-
t
|
|
38
|
+
if (this[x(171)][x(174)]) {
|
|
39
|
+
if (typeof e === x(172)) {
|
|
40
|
+
const c = e[x(125)](".pdf") > -1 ? e : e + x(179);
|
|
41
|
+
t.name = c;
|
|
48
42
|
} else
|
|
49
|
-
t =
|
|
50
|
-
let
|
|
51
|
-
var
|
|
52
|
-
const
|
|
53
|
-
var
|
|
54
|
-
t && (t
|
|
55
|
-
var
|
|
56
|
-
if (R && t
|
|
57
|
-
let
|
|
58
|
-
const
|
|
59
|
-
let s = globalThis.$(x(
|
|
60
|
-
|
|
43
|
+
t = e || {}, !t[x(182)] && (t[x(182)] = x(193) + Date[x(131)]() + ".pdf");
|
|
44
|
+
let _ = this[x(171)][0][x(141)], P = this[x(171)][0].height;
|
|
45
|
+
var u = globalThis.hinnn.mm[x(162)](t[x(175)] || _), A = globalThis[x(140)].mm[x(162)](t[x(153)] || P), f = globalThis.$[x(197)]({}, t || {});
|
|
46
|
+
const d = this[x(171)][0][x(128)], r = this[x(171)][0][x(176)], R = r && (r[x(132)] > 0 || r[x(129)] > 0), q = d != null && d != "" && d != x(144);
|
|
47
|
+
var C = new B({ orientation: this[x(161)](0) == 1 ? x(136) : x(181), unit: "pt", format: q ? d.toLocaleLowerCase() : [u, A] }), g = yield this[x(164)](i, t);
|
|
48
|
+
t && (t.pixelRatio && (f.dpr = t[x(198)], f.scale = t[x(198)]), t[x(134)] != null && (w = t[x(134)]), t[x(148)] != null && (m = t[x(148)])), globalThis.$(g)[x(137)](x(141), "")[x(137)](x(183), ""), this[x(194)]();
|
|
49
|
+
var v = this[x(155)]();
|
|
50
|
+
if (R && t[x(175)] && t[x(153)]) {
|
|
51
|
+
let c = Math[x(199)](t.paperWidth / (_ + r.layoutRowGap / 2)), h = Math.floor(t[x(153)] / (P + r.layoutColumnGap / 2));
|
|
52
|
+
const T = c * h, l = g[x(139)](x(123)), y = l[x(174)], n = Math[x(120)](y / T);
|
|
53
|
+
let s = globalThis.$(x(146));
|
|
54
|
+
r[x(186)] == x(173) ? s[x(168)](x(135) + (Number(r[x(132)]) || 0) / 2 + x(122) + (Number(r.layoutColumnGap) || 0) / 2 + `mm;
|
|
61
55
|
}
|
|
62
56
|
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
63
57
|
display:inline-block;
|
|
64
|
-
padding: ` + (Number(
|
|
58
|
+
padding: ` + (Number(r[x(132)]) || 0) / 2 + "mm " + (Number(r.layoutColumnGap) || 0) / 2 + x(185)) : s[x(168)](`<style>
|
|
65
59
|
.hiprint-printPanel-small{
|
|
66
60
|
box-sizing: border-box;
|
|
67
61
|
border: 0px;
|
|
@@ -75,69 +69,74 @@ const U = function(e, n, a) {
|
|
|
75
69
|
flex-wrap: wrap;
|
|
76
70
|
flex-direction: column;
|
|
77
71
|
align-content: flex-start;
|
|
78
|
-
margin: -` + (Number(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const G = globalThis.$(x(143) + t.paperWidth + "mm;height:" + t[x(147)] + x(192)), D = o * _, H = Math.min((o + 1) * _, y);
|
|
87
|
-
for (let M = D; M < H; M++) {
|
|
88
|
-
const j = T.eq(M)[x(136)]();
|
|
89
|
-
j[x(138)](x(186)), j[x(173)]("hiprint-printPaper-small start-" + M);
|
|
90
|
-
const L = globalThis.$(x(145));
|
|
91
|
-
L[x(129)](j), G[x(149)](x(132))[x(129)](L);
|
|
72
|
+
margin: -` + (Number(r[x(132)]) || 0) / 2 + "mm -" + (Number(r[x(129)]) || 0) / 2 + x(204) + (Number(r[x(132)]) || 0) / 2 + x(157) + (Number(r.layoutColumnGap) || 0) / 2 + x(185));
|
|
73
|
+
for (let p = 0; p < n; p++) {
|
|
74
|
+
const G = globalThis.$(x(152) + t.paperWidth + x(154) + t[x(153)] + x(118)), $ = p * T, U = Math.min((p + 1) * T, y);
|
|
75
|
+
for (let N = $; N < U; N++) {
|
|
76
|
+
const J = l.eq(N)[x(150)]();
|
|
77
|
+
J[x(127)](x(170)), J[x(158)](x(160) + N);
|
|
78
|
+
const L = globalThis.$('<div class="hiprint-printPanel-small"></div>');
|
|
79
|
+
L.append(J), G[x(139)](x(178)).append(L);
|
|
92
80
|
}
|
|
93
|
-
s
|
|
81
|
+
s.append(G);
|
|
94
82
|
}
|
|
95
|
-
this
|
|
83
|
+
this[x(169)](s, f), v[x(145)](s[0]), globalThis.$(s)[x(137)](x(200));
|
|
96
84
|
} else
|
|
97
|
-
this
|
|
98
|
-
let
|
|
99
|
-
this.loadAllImages(
|
|
100
|
-
const
|
|
85
|
+
this.svg2canvas(g, f), v[x(145)](g[0]), globalThis.$(g)[x(137)](x(200));
|
|
86
|
+
let M = v[x(139)](x(123))[x(174)];
|
|
87
|
+
this.loadAllImages(v, function() {
|
|
88
|
+
const c = x;
|
|
101
89
|
try {
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
globalThis
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
var G = s[
|
|
109
|
-
G
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
})[
|
|
113
|
-
const
|
|
114
|
-
throw new Error(s[
|
|
90
|
+
v[c(139)](c(123))[c(165)](function(h, T) {
|
|
91
|
+
const l = c;
|
|
92
|
+
globalThis[l(140)][l(191)][l(119)](function(y) {
|
|
93
|
+
const n = l;
|
|
94
|
+
W[n(147)](T, f)[n(159)](function(s) {
|
|
95
|
+
const p = n;
|
|
96
|
+
var G = s[p(180)]("2d");
|
|
97
|
+
G[p(126)] = ![];
|
|
98
|
+
var $ = s[p(142)]("image/jpeg", f.quality || 0.92);
|
|
99
|
+
C[p(205)]($, "JPEG", 0, 0, u, A), h < M - 1 && C[p(124)](), m(h + 1, M), y();
|
|
100
|
+
})[n(121)]((s) => {
|
|
101
|
+
const p = n;
|
|
102
|
+
throw new Error(s[p(206)]);
|
|
115
103
|
});
|
|
116
|
-
}), h ==
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
|
|
104
|
+
}), h == M - 1 && (globalThis[l(140)][l(191)][l(119)](function(y) {
|
|
105
|
+
const n = l;
|
|
106
|
+
if (w)
|
|
107
|
+
o[n(202)](), C[n(130)](t[n(182)]);
|
|
120
108
|
else {
|
|
121
|
-
|
|
122
|
-
let s = t[
|
|
123
|
-
|
|
109
|
+
o[n(202)]();
|
|
110
|
+
let s = t[n(167)] || "blob", p = C[n(149)](s);
|
|
111
|
+
b[n(166)](p);
|
|
124
112
|
}
|
|
125
|
-
globalThis[
|
|
126
|
-
}), globalThis[
|
|
113
|
+
globalThis.hinnn[n(191)][n(203)]();
|
|
114
|
+
}), globalThis[l(140)].queue.run());
|
|
127
115
|
});
|
|
128
116
|
} catch (h) {
|
|
129
|
-
console
|
|
117
|
+
console[c(163)](c(188)), console[c(156)](h);
|
|
130
118
|
}
|
|
131
119
|
});
|
|
132
120
|
}
|
|
133
|
-
return
|
|
121
|
+
return b[x(190)]();
|
|
134
122
|
});
|
|
135
123
|
};
|
|
136
|
-
function
|
|
137
|
-
const
|
|
124
|
+
function I(i, e) {
|
|
125
|
+
const a = k();
|
|
126
|
+
return I = function(x, o) {
|
|
127
|
+
return x = x - 118, a[x];
|
|
128
|
+
}, I(i, e);
|
|
129
|
+
}
|
|
130
|
+
function k() {
|
|
131
|
+
const i = ["clone", "6dMscGT", `<div class="hiprint-printPanel">
|
|
132
|
+
<div class="hiprint-printPaper" style="width:`, "paperHeight", "mm;height:", "getTempContainer", "log", "mm ", "addClass", "then", "hiprint-printPaper-small start-", "getOrient", "toPt", "error", "getHtml", "each", "resolve", "type", "append", "svg2canvas", "hiprint-printPaper", "printPanels", "string", "row", "length", "paperWidth", "panelLayoutOptions", "1023631wWoxaT", ".hiprint-printPaper", ".pdf", "getContext", "landscape", "name", "height", "30WptyTU", `mm;
|
|
133
|
+
}
|
|
134
|
+
</style>`, "layoutType", "toPdf percent: ", "toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "1168448GPmBDt", "promise", "queue", "total", "sv-print-", "createTempContainer", "2647114kIxruS", "1428210JcRIkc", "extend", "pixelRatio", "floor", "position:fixed", "261MdYkZK", "removeTempContainer", "clear", `mm;
|
|
138
135
|
}
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
137
|
+
display:inline-block;
|
|
138
|
+
padding: `, "addImage", "message", `mm;"></div>
|
|
139
|
+
</div>`, "add", "ceil", "catch", "mm -", ".hiprint-printPanel .hiprint-printPaper", "addPage", "indexOf", "imageSmoothingEnabled", "removeClass", "paperType", "layoutColumnGap", "save", "now", "layoutRowGap", "303088jpjeEu", "isDownload", `<style>
|
|
141
140
|
.hiprint-printPanel-small{
|
|
142
141
|
box-sizing: border-box;
|
|
143
142
|
border: 0px;
|
|
@@ -147,44 +146,43 @@ function N() {
|
|
|
147
146
|
padding: 0;
|
|
148
147
|
}
|
|
149
148
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
150
|
-
margin: -`, "
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}, N();
|
|
149
|
+
margin: -`, "portrait", "css", "2985212aXroAw", "find", "hinnn", "width", "toDataURL", "4722770jKjDwl", "\u81EA\u5B9A\u4E49", "html", '<div class="hiprint-printTemplate"></div>', "toCanvas", "onProgress", "output"];
|
|
150
|
+
return k = function() {
|
|
151
|
+
return i;
|
|
152
|
+
}, k();
|
|
155
153
|
}
|
|
156
|
-
(function(
|
|
157
|
-
for (var a =
|
|
154
|
+
(function(i, e) {
|
|
155
|
+
for (var a = j, x = i(); []; )
|
|
158
156
|
try {
|
|
159
|
-
var
|
|
160
|
-
if (
|
|
157
|
+
var o = parseInt(a(285)) / 1 * (-parseInt(a(271)) / 2) + -parseInt(a(278)) / 3 * (-parseInt(a(274)) / 4) + parseInt(a(276)) / 5 * (-parseInt(a(270)) / 6) + -parseInt(a(269)) / 7 * (parseInt(a(281)) / 8) + parseInt(a(286)) / 9 + -parseInt(a(282)) / 10 + -parseInt(a(279)) / 11 * (-parseInt(a(272)) / 12);
|
|
158
|
+
if (o === e)
|
|
161
159
|
break;
|
|
162
160
|
x.push(x.shift());
|
|
163
|
-
} catch (
|
|
161
|
+
} catch (b) {
|
|
164
162
|
x.push(x.shift());
|
|
165
163
|
}
|
|
166
|
-
})(
|
|
167
|
-
function
|
|
168
|
-
var
|
|
169
|
-
return
|
|
170
|
-
return
|
|
171
|
-
},
|
|
164
|
+
})(D, 888198);
|
|
165
|
+
function D() {
|
|
166
|
+
var i = ["defineProperty", "add toPdf Api to PrintTemplate", "2723IGOXJN", "8021799kZgTqd", "101689obIHjr", "195666UJaNvt", "530sNXPXd", "29986056hlVKwJ", "0.3.0", "2852356gBcZAa", "newPrintTemplate", "30pJdmwU", "toPdf", "6DDlCVP", "11vOMLVp", "add toPdf Api", "808UNSBJG", "15436410LeGBkC"];
|
|
167
|
+
return D = function() {
|
|
168
|
+
return i;
|
|
169
|
+
}, D();
|
|
172
170
|
}
|
|
173
|
-
function
|
|
174
|
-
var a =
|
|
175
|
-
return
|
|
176
|
-
x = x -
|
|
177
|
-
var
|
|
178
|
-
return
|
|
179
|
-
},
|
|
171
|
+
function j(i, e) {
|
|
172
|
+
var a = D();
|
|
173
|
+
return j = function(x, o) {
|
|
174
|
+
x = x - 269;
|
|
175
|
+
var b = a[x];
|
|
176
|
+
return b;
|
|
177
|
+
}, j(i, e);
|
|
180
178
|
}
|
|
181
|
-
function
|
|
182
|
-
var
|
|
183
|
-
return { name:
|
|
184
|
-
var
|
|
185
|
-
Object[
|
|
186
|
-
} }], leastHiprintVersion:
|
|
179
|
+
function K(i) {
|
|
180
|
+
var e = j;
|
|
181
|
+
return { name: "add toPdf Api", description: e(280), hooks: [{ hook: e(275), name: e(284), description: e(284), priority: 1, run: ({ template: a, options: x }) => {
|
|
182
|
+
var o = e;
|
|
183
|
+
Object[o(283)](a, o(277), { value: E, enumerable: ![], writable: !![], configurable: !![] });
|
|
184
|
+
} }], leastHiprintVersion: e(273) };
|
|
187
185
|
}
|
|
188
186
|
export {
|
|
189
|
-
|
|
187
|
+
K as default
|
|
190
188
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(d,
|
|
1
|
+
(function(d,h){typeof exports=="object"&&typeof module!="undefined"?module.exports=h(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],h):(d=typeof globalThis!="undefined"?globalThis:d||self,d.pluginApiPdf=h(d.window,d.jspdf))})(this,function(d,h){"use strict";var W=(d,h,g)=>new Promise((m,u)=>{var v=n=>{try{y(g.next(n))}catch(e){u(e)}},P=n=>{try{y(g.throw(n))}catch(e){u(e)}},y=n=>n.done?m(n.value):Promise.resolve(n.value).then(v,P);y((g=g.apply(d,h)).next())});(function(n,e){const a=m,x=n();for(;[];)try{if(parseInt(a(189))/1+-parseInt(a(195))/2+-parseInt(a(151))/3*(parseInt(a(138))/4)+-parseInt(a(143))/5+-parseInt(a(184))/6*(parseInt(a(177))/7)+-parseInt(a(133))/8+-parseInt(a(201))/9*(-parseInt(a(196))/10)===e)break;x.push(x.shift())}catch(l){x.push(x.shift())}})(u,780489);const g=function(n,e,a){return W(this,null,function*(){const x=m;var l=this,_=globalThis.$.Deferred(),J=!![];let L=(C,G)=>{const b=m,r=Math[b(199)](C/G*100);console.log("cur",C,b(192),G),console[b(156)](b(187),r+"%")},t=a||{};if(this[x(171)][x(174)]){if(typeof e===x(172)){const c=e[x(125)](".pdf")>-1?e:e+x(179);t.name=c}else t=e||{},!t[x(182)]&&(t[x(182)]=x(193)+Date[x(131)]()+".pdf");let C=this[x(171)][0][x(141)],G=this[x(171)][0].height;var O=globalThis.hinnn.mm[x(162)](t[x(175)]||C),R=globalThis[x(140)].mm[x(162)](t[x(153)]||G),T=globalThis.$[x(197)]({},t||{});const b=this[x(171)][0][x(128)],r=this[x(171)][0][x(176)],z=r&&(r[x(132)]>0||r[x(129)]>0),B=b!=null&&b!=""&&b!=x(144);var k=new h.jsPDF({orientation:this[x(161)](0)==1?x(136):x(181),unit:"pt",format:B?b.toLocaleLowerCase():[O,R]}),I=yield this[x(164)](n,t);t&&(t.pixelRatio&&(T.dpr=t[x(198)],T.scale=t[x(198)]),t[x(134)]!=null&&(J=t[x(134)]),t[x(148)]!=null&&(L=t[x(148)])),globalThis.$(I)[x(137)](x(141),"")[x(137)](x(183),""),this[x(194)]();var w=this[x(155)]();if(z&&t[x(175)]&&t[x(153)]){let c=Math[x(199)](t.paperWidth/(C+r.layoutRowGap/2)),f=Math.floor(t[x(153)]/(G+r.layoutColumnGap/2));const j=c*f,s=I[x(139)](x(123)),N=s[x(174)],i=Math[x(120)](N/j);let p=globalThis.$(x(146));r[x(186)]==x(173)?p[x(168)](x(135)+(Number(r[x(132)])||0)/2+x(122)+(Number(r.layoutColumnGap)||0)/2+`mm;
|
|
2
2
|
}
|
|
3
3
|
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
4
|
display:inline-block;
|
|
5
|
-
padding: `+(Number(
|
|
5
|
+
padding: `+(Number(r[x(132)])||0)/2+"mm "+(Number(r.layoutColumnGap)||0)/2+x(185)):p[x(168)](`<style>
|
|
6
6
|
.hiprint-printPanel-small{
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
border: 0px;
|
|
@@ -16,16 +16,15 @@
|
|
|
16
16
|
flex-wrap: wrap;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
align-content: flex-start;
|
|
19
|
-
margin: -`+(Number(
|
|
19
|
+
margin: -`+(Number(r[x(132)])||0)/2+"mm -"+(Number(r[x(129)])||0)/2+x(204)+(Number(r[x(132)])||0)/2+x(157)+(Number(r.layoutColumnGap)||0)/2+x(185));for(let o=0;o<i;o++){const D=globalThis.$(x(152)+t.paperWidth+x(154)+t[x(153)]+x(118)),q=o*j,E=Math.min((o+1)*j,N);for(let M=q;M<E;M++){const A=s.eq(M)[x(150)]();A[x(127)](x(170)),A[x(158)](x(160)+M);const U=globalThis.$('<div class="hiprint-printPanel-small"></div>');U.append(A),D[x(139)](x(178)).append(U)}p.append(D)}this[x(169)](p,T),w[x(145)](p[0]),globalThis.$(p)[x(137)](x(200))}else this.svg2canvas(I,T),w[x(145)](I[0]),globalThis.$(I)[x(137)](x(200));let $=w[x(139)](x(123))[x(174)];this.loadAllImages(w,function(){const c=x;try{w[c(139)](c(123))[c(165)](function(f,j){const s=c;globalThis[s(140)][s(191)][s(119)](function(N){const i=s;d.snapdom[i(147)](j,T)[i(159)](function(p){const o=i;var D=p[o(180)]("2d");D[o(126)]=![];var q=p[o(142)]("image/jpeg",T.quality||.92);k[o(205)](q,"JPEG",0,0,O,R),f<$-1&&k[o(124)](),L(f+1,$),N()})[i(121)](p=>{const o=i;throw new Error(p[o(206)])})}),f==$-1&&(globalThis[s(140)][s(191)][s(119)](function(N){const i=s;if(J)l[i(202)](),k[i(130)](t[i(182)]);else{l[i(202)]();let p=t[i(167)]||"blob",o=k[i(149)](p);_[i(166)](o)}globalThis.hinnn[i(191)][i(203)]()}),globalThis[s(140)].queue.run())})}catch(f){console[c(163)](c(188)),console[c(156)](f)}})}return _[x(190)]()})};function m(n,e){const a=u();return m=function(x,l){return x=x-118,a[x]},m(n,e)}function u(){const n=["clone","6dMscGT",`<div class="hiprint-printPanel">
|
|
20
|
+
<div class="hiprint-printPaper" style="width:`,"paperHeight","mm;height:","getTempContainer","log","mm ","addClass","then","hiprint-printPaper-small start-","getOrient","toPt","error","getHtml","each","resolve","type","append","svg2canvas","hiprint-printPaper","printPanels","string","row","length","paperWidth","panelLayoutOptions","1023631wWoxaT",".hiprint-printPaper",".pdf","getContext","landscape","name","height","30WptyTU",`mm;
|
|
21
|
+
}
|
|
22
|
+
</style>`,"layoutType","toPdf percent: ","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","1168448GPmBDt","promise","queue","total","sv-print-","createTempContainer","2647114kIxruS","1428210JcRIkc","extend","pixelRatio","floor","position:fixed","261MdYkZK","removeTempContainer","clear",`mm;
|
|
20
23
|
}
|
|
21
24
|
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
22
25
|
display:inline-block;
|
|
23
|
-
padding:
|
|
24
|
-
|
|
25
|
-
</style>`);for(let p=0;p<r;p++){const M=globalThis.$(x(143)+a.paperWidth+"mm;height:"+a[x(147)]+x(192)),z=p*w,U=Math.min((p+1)*w,j);for(let N=z;N<U;N++){const D=C.eq(N)[x(136)]();D[x(138)](x(186)),D[x(173)]("hiprint-printPaper-small start-"+N);const A=globalThis.$(x(145));A[x(129)](D),M[x(149)](x(132))[x(129)](A)}s[x(129)](M)}this.svg2canvas(s,v),G[x(200)](s[0]),globalThis.$(s).css(x(164))}else this[x(123)](_,v),G[x(200)](_[0]),globalThis.$(_)[x(148)](x(164));let $=G[x(149)](x(189)).length;this.loadAllImages(_,function(){const h=x;try{G[h(149)](".hiprint-printPanel .hiprint-printPaper").each(function(m,w){const C=h;globalThis.hinnn.queue.add(function(j){const r=o;d.snapdom[r(135)](w,v).then(function(s){const p=r;var M=s[p(153)]("2d");M.imageSmoothingEnabled=![];var z=s[p(162)](p(146),v[p(196)]||.92);q.addImage(z,"JPEG",0,0,O,R),m<$-1&&q[p(177)](),L(m+1,$),j()})[r(125)](s=>{const p=r;throw new Error(s[p(190)])})}),m==$-1&&(globalThis.hinnn.queue.add(function(j){const r=o;if(k)l[r(155)](),q[r(166)](a.name);else{l[r(155)]();let s=a[r(128)]||"blob",p=q[r(182)](s);P.resolve(p)}globalThis[r(152)][r(201)][r(188)]()}),globalThis[C(152)][C(201)].run())})}catch(m){console.error(h(154)),console[h(122)](m)}})}return P[x(187)]()})};function b(){const n=["mm -",`mm;
|
|
26
|
-
}
|
|
27
|
-
</style>`,"hiprint-printPaper","promise","clear",".hiprint-printPanel .hiprint-printPaper","message","printPanels",`mm;"></div>
|
|
28
|
-
</div>`,"toPt","sv-print-","now","quality","layoutColumnGap","paperWidth","panelLayoutOptions","html","queue","\u81EA\u5B9A\u4E49","log","svg2canvas","cur","catch","portrait",`<style>
|
|
26
|
+
padding: `,"addImage","message",`mm;"></div>
|
|
27
|
+
</div>`,"add","ceil","catch","mm -",".hiprint-printPanel .hiprint-printPaper","addPage","indexOf","imageSmoothingEnabled","removeClass","paperType","layoutColumnGap","save","now","layoutRowGap","303088jpjeEu","isDownload",`<style>
|
|
29
28
|
.hiprint-printPanel-small{
|
|
30
29
|
box-sizing: border-box;
|
|
31
30
|
border: 0px;
|
|
@@ -35,5 +34,4 @@
|
|
|
35
34
|
padding: 0;
|
|
36
35
|
}
|
|
37
36
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
38
|
-
margin: -`,"
|
|
39
|
-
<div class="hiprint-printPaper" style="width:`,'<div class="hiprint-printTemplate"></div>','<div class="hiprint-printPanel-small"></div>',"image/jpeg","paperHeight","css","find","496410JphQqu","225bzKKfo","hinnn","getContext","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","removeTempContainer","getTempContainer","ceil","toLocaleLowerCase","8150280QDxloM",".pdf","extend","toDataURL","mm ","position:fixed","11KwWWQW","save","height","20217frWypB","106MoILUW","length","row","6224LxddCb","addClass","80Jstxgz","createTempContainer","pixelRatio","addPage","157860aXheQJ","onProgress","indexOf","isDownload","output","width"];return b=function(){return n},b()}(function(n,e){for(var t=g,x=n();[];)try{var l=-parseInt(t(372))/1*(-parseInt(t(378))/2)+-parseInt(t(384))/3*(parseInt(t(382))/4)+-parseInt(t(373))/5*(parseInt(t(385))/6)+parseInt(t(377))/7*(parseInt(t(383))/8)+-parseInt(t(368))/9*(parseInt(t(369))/10)+parseInt(t(374))/11*(parseInt(t(370))/12)+parseInt(t(371))/13;if(l===e)break;x.push(x.shift())}catch(P){x.push(x.shift())}})(u,481406);function u(){var n=["27MOEhSM","2658680YUaTMa","5557548stYncn","16497676NlNbli","11923zUbcJC","37975mfUsZp","11xDpdlH","toPdf","add toPdf Api to PrintTemplate","173243Bcupwv","64wscRfe","newPrintTemplate","defineProperty","add toPdf Api","1557396BomoGG","104eqxYYo","3QWpgdj","606hmxlWr"];return u=function(){return n},u()}function g(n,e){var t=u();return g=function(x,l){x=x-368;var P=t[x];return P},g(n,e)}function T(n){var e=g;return{name:e(381),description:e(381),hooks:[{hook:e(379),name:"add toPdf Api to PrintTemplate",description:e(376),priority:1,run:({template:t,options:x})=>{var l=e;Object[l(380)](t,l(375),{value:W,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}return T});
|
|
37
|
+
margin: -`,"portrait","css","2985212aXroAw","find","hinnn","width","toDataURL","4722770jKjDwl","\u81EA\u5B9A\u4E49","html",'<div class="hiprint-printTemplate"></div>',"toCanvas","onProgress","output"];return u=function(){return n},u()}(function(n,e){for(var a=P,x=n();[];)try{var l=parseInt(a(285))/1*(-parseInt(a(271))/2)+-parseInt(a(278))/3*(-parseInt(a(274))/4)+parseInt(a(276))/5*(-parseInt(a(270))/6)+-parseInt(a(269))/7*(parseInt(a(281))/8)+parseInt(a(286))/9+-parseInt(a(282))/10+-parseInt(a(279))/11*(-parseInt(a(272))/12);if(l===e)break;x.push(x.shift())}catch(_){x.push(x.shift())}})(v,888198);function v(){var n=["defineProperty","add toPdf Api to PrintTemplate","2723IGOXJN","8021799kZgTqd","101689obIHjr","195666UJaNvt","530sNXPXd","29986056hlVKwJ","0.3.0","2852356gBcZAa","newPrintTemplate","30pJdmwU","toPdf","6DDlCVP","11vOMLVp","add toPdf Api","808UNSBJG","15436410LeGBkC"];return v=function(){return n},v()}function P(n,e){var a=v();return P=function(x,l){x=x-269;var _=a[x];return _},P(n,e)}function y(n){var e=P;return{name:"add toPdf Api",description:e(280),hooks:[{hook:e(275),name:e(284),description:e(284),priority:1,run:({template:a,options:x})=>{var l=e;Object[l(283)](a,l(277),{value:g,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(273)}}return y});
|