@sv-print/plugin-api-pdf 0.2.1 → 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 -37
- package/dist/index.mjs +106 -162
- package/dist/index.umd.js +1 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
}
|
|
3
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
|
-
display:inline-block;
|
|
5
|
-
padding: `+(Number(r[x(132)])||0)/2+"mm "+(Number(r.layoutColumnGap)||0)/2+x(185)):s[x(168)](`<style>
|
|
6
|
-
.hiprint-printPanel-small{
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
border: 0px;
|
|
9
|
-
}
|
|
10
|
-
.hiprint-printPaper-small{
|
|
11
|
-
position: relative;
|
|
12
|
-
padding: 0;
|
|
13
|
-
}
|
|
14
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-wrap: wrap;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
align-content: flex-start;
|
|
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;
|
|
23
|
-
}
|
|
24
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
25
|
-
display:inline-block;
|
|
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>
|
|
28
|
-
.hiprint-printPanel-small{
|
|
29
|
-
box-sizing: border-box;
|
|
30
|
-
border: 0px;
|
|
31
|
-
}
|
|
32
|
-
.hiprint-printPaper-small{
|
|
33
|
-
position: relative;
|
|
34
|
-
padding: 0;
|
|
35
|
-
}
|
|
36
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
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;
|
|
1
|
+
"use strict";var S=(a,n,x)=>new Promise((e,o)=>{var d=t=>{try{p(x.next(t))}catch(f){o(f)}},m=t=>{try{p(x.throw(t))}catch(f){o(f)}},p=t=>t.done?e(t.value):Promise.resolve(t.value).then(d,m);p((x=x.apply(a,n)).next())});const U=require("@zumer/snapdom"),W=require("jspdf");(function(a,n){const x=y,e=a();for(;;)try{if(-parseInt(x(181))/1*(-parseInt(x(219))/2)+parseInt(x(213))/3+-parseInt(x(220))/4*(parseInt(x(212))/5)+-parseInt(x(200))/6*(parseInt(x(182))/7)+parseInt(x(227))/8+parseInt(x(203))/9+-parseInt(x(184))/10===n)break;e.push(e.shift())}catch(o){e.push(e.shift())}})(w,998909);function w(){const a=["3358983pLJjpl","paperHeight","pixelRatio","Deferred","extend","each","108cpHUHk","152tMUSqg","getOrient","addImage","createTempContainer","JPEG","printPanels","height","2738168EjIhWV","getHtml","add","#fff","自定义","name","paperWidth",".pdf","toPdf percent: ","floor",".hiprint-printPanel .hiprint-printPaper","resolve","hinnn","output","position:fixed","image/jpeg","message","indexOf","blob","toPdf 失败(可能您的图片资源无法正常加载): ","toCanvas","portrait","removeTempContainer","25766FaCiRS","455518znuvMt","clear","29328650AEjNPL","promise","queue","error","toLocaleLowerCase","toDataURL","length","catch","quality","onProgress","css","width","paperType","isDownload","find","then","12OdchtS","loadAllImages","html","11243232ZnkyFS","scale","run","toPt","imageSmoothingEnabled","now","log","svg2canvas","landscape","5345BKGGqa"];return w=function(){return a},w()}const F=function(a,n,x){return S(this,null,function*(){const e=y;var o=this,d=globalThis.$[e(216)](),m=!0;let p=(I,T)=>{const l=e,b=Math[l(236)](I/T*100);console[l(209)]("cur",I,"total",T),console.log(l(235),b+"%")},t=x||{};if(this[e(225)].length){if(typeof n=="string"){const s=n[e(175)](e(234))>-1?n:n+e(234);t[e(232)]=s}else t=n||{},!t.name&&(t.name="sv-print-"+Date[e(208)]()+e(234));let I=this[e(225)][0][e(195)],T=this[e(225)][0][e(226)];const l=t[e(233)]&&t[e(214)];var f=globalThis.hinnn.mm[e(206)](t[e(233)]||I),q=globalThis.hinnn.mm[e(206)](t[e(214)]||T),u=globalThis.$[e(217)]({backgroundColor:e(230)},t||{});const b=this[e(225)][0][e(196)],D=b!=null&&b!=""&&b!=e(231),O=this[e(221)](0)==1||l?e(179):e(211),E=D&&!l?b[e(188)]():[f,q];var v=new W.jsPDF({orientation:O,unit:"pt",format:E}),_=yield this[e(228)](a,t);t&&(t[e(215)]&&(u.dpr=t[e(215)],u[e(204)]=t.pixelRatio),t.isDownload!=null&&(m=t[e(197)]),t[e(193)]!=null&&(p=t[e(193)])),globalThis.$(_).css(e(195),"")[e(194)](e(226),""),this[e(223)]();var P=this.getTempContainer();this[e(210)](_,u),P[e(202)](_[0]),globalThis.$(_).css(e(241));let j=P[e(198)](e(237))[e(190)];this[e(201)](P,function(){const s=e;try{P[s(198)](s(237))[s(218)](function(g,H){const c=s;globalThis[c(239)].queue.add(function(A){const r=c;U.snapdom[r(178)](H,u)[r(199)](function(h){const i=r;var L=h.getContext("2d");L[i(207)]=!1;var R=h[i(189)](i(242),u[i(192)]||.92);v[i(222)](R,i(224),0,0,f,q),g<j-1&&v.addPage(),p(g+1,j),A()})[r(191)](h=>{const i=r;throw new Error(h[i(243)])})}),g==j-1&&(globalThis[c(239)][c(186)][c(229)](function(A){const r=c;if(m)o[r(180)](),v.save(t[r(232)]);else{o[r(180)]();let h=t.type||r(176),i=v[r(240)](h);d[r(238)](i)}globalThis.hinnn[r(186)][r(183)]()}),globalThis[c(239)][c(186)][c(205)]())})}catch(g){console[s(187)](s(177)),console[s(209)](g)}})}return d[e(185)]()})};function y(a,n){const x=w();return y=function(e,o){return e=e-175,x[e]},y(a,n)}(function(a,n){for(var x=k,e=a();;)try{var o=parseInt(x(110))/1+-parseInt(x(108))/2*(parseInt(x(113))/3)+parseInt(x(115))/4*(-parseInt(x(114))/5)+-parseInt(x(112))/6+parseInt(x(109))/7+-parseInt(x(111))/8*(parseInt(x(119))/9)+parseInt(x(121))/10;if(o===n)break;e.push(e.shift())}catch(d){e.push(e.shift())}})(C,452171);function k(a,n){var x=C();return k=function(e,o){e=e-107;var d=x[e];return d},k(a,n)}function J(a){var n=k;return{name:n(120),description:"add toPdf Api",hooks:[{hook:"newPrintTemplate",name:"add toPdf Api to PrintTemplate",description:n(118),priority:1,run:({template:x,options:e})=>{var o=n;Object[o(107)](x,o(116),{value:F,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(117)}}function C(){var a=["add toPdf Api","9333550RwXQdP","defineProperty","312718ZVTmse","539938NUAttv","824089SpfuXz","40TnvvPr","1473846SJXJZg","6WFTWOY","161065QkcmVK","44xZTOUo","toPdf","0.3.0","add toPdf Api to PrintTemplate","845469rygPpW"];return C=function(){return a},C()}module.exports=J;
|
package/dist/index.mjs
CHANGED
|
@@ -1,188 +1,132 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var D = (a, n, x) => new Promise((e, o) => {
|
|
2
|
+
var d = (t) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
o(
|
|
4
|
+
f(x.next(t));
|
|
5
|
+
} catch (p) {
|
|
6
|
+
o(p);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, m = (t) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
o(
|
|
10
|
+
f(x.throw(t));
|
|
11
|
+
} catch (p) {
|
|
12
|
+
o(p);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, f = (t) => t.done ? e(t.value) : Promise.resolve(t.value).then(d, m);
|
|
15
|
+
f((x = x.apply(a, n)).next());
|
|
16
16
|
});
|
|
17
|
-
import { snapdom as
|
|
18
|
-
import { jsPDF as
|
|
19
|
-
(function(
|
|
20
|
-
const
|
|
21
|
-
for (;
|
|
17
|
+
import { snapdom as U } from "@zumer/snapdom";
|
|
18
|
+
import { jsPDF as W } from "jspdf";
|
|
19
|
+
(function(a, n) {
|
|
20
|
+
const x = y, e = a();
|
|
21
|
+
for (; ; )
|
|
22
22
|
try {
|
|
23
|
-
if (parseInt(
|
|
24
|
-
|
|
25
|
-
x.push(x.shift());
|
|
23
|
+
if (-parseInt(x(181)) / 1 * (-parseInt(x(219)) / 2) + parseInt(x(213)) / 3 + -parseInt(x(220)) / 4 * (parseInt(x(212)) / 5) + -parseInt(x(200)) / 6 * (parseInt(x(182)) / 7) + parseInt(x(227)) / 8 + parseInt(x(203)) / 9 + -parseInt(x(184)) / 10 === n) break;
|
|
24
|
+
e.push(e.shift());
|
|
26
25
|
} catch (o) {
|
|
27
|
-
|
|
26
|
+
e.push(e.shift());
|
|
28
27
|
}
|
|
29
|
-
})(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
box-sizing: border-box;
|
|
61
|
-
border: 0px;
|
|
62
|
-
}
|
|
63
|
-
.hiprint-printPaper-small{
|
|
64
|
-
position: relative;
|
|
65
|
-
padding: 0;
|
|
66
|
-
}
|
|
67
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
68
|
-
display: flex;
|
|
69
|
-
flex-wrap: wrap;
|
|
70
|
-
flex-direction: column;
|
|
71
|
-
align-content: flex-start;
|
|
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);
|
|
80
|
-
}
|
|
81
|
-
s.append(G);
|
|
82
|
-
}
|
|
83
|
-
this[x(169)](s, f), v[x(145)](s[0]), globalThis.$(s)[x(137)](x(200));
|
|
84
|
-
} else
|
|
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;
|
|
28
|
+
})(w, 998909);
|
|
29
|
+
function w() {
|
|
30
|
+
const a = ["3358983pLJjpl", "paperHeight", "pixelRatio", "Deferred", "extend", "each", "108cpHUHk", "152tMUSqg", "getOrient", "addImage", "createTempContainer", "JPEG", "printPanels", "height", "2738168EjIhWV", "getHtml", "add", "#fff", "自定义", "name", "paperWidth", ".pdf", "toPdf percent: ", "floor", ".hiprint-printPanel .hiprint-printPaper", "resolve", "hinnn", "output", "position:fixed", "image/jpeg", "message", "indexOf", "blob", "toPdf 失败(可能您的图片资源无法正常加载): ", "toCanvas", "portrait", "removeTempContainer", "25766FaCiRS", "455518znuvMt", "clear", "29328650AEjNPL", "promise", "queue", "error", "toLocaleLowerCase", "toDataURL", "length", "catch", "quality", "onProgress", "css", "width", "paperType", "isDownload", "find", "then", "12OdchtS", "loadAllImages", "html", "11243232ZnkyFS", "scale", "run", "toPt", "imageSmoothingEnabled", "now", "log", "svg2canvas", "landscape", "5345BKGGqa"];
|
|
31
|
+
return w = function() {
|
|
32
|
+
return a;
|
|
33
|
+
}, w();
|
|
34
|
+
}
|
|
35
|
+
const F = function(a, n, x) {
|
|
36
|
+
return D(this, null, function* () {
|
|
37
|
+
const e = y;
|
|
38
|
+
var o = this, d = globalThis.$[e(216)](), m = !0;
|
|
39
|
+
let f = (I, T) => {
|
|
40
|
+
const l = e, b = Math[l(236)](I / T * 100);
|
|
41
|
+
console[l(209)]("cur", I, "total", T), console.log(l(235), b + "%");
|
|
42
|
+
}, t = x || {};
|
|
43
|
+
if (this[e(225)].length) {
|
|
44
|
+
if (typeof n == "string") {
|
|
45
|
+
const s = n[e(175)](e(234)) > -1 ? n : n + e(234);
|
|
46
|
+
t[e(232)] = s;
|
|
47
|
+
} else t = n || {}, !t.name && (t.name = "sv-print-" + Date[e(208)]() + e(234));
|
|
48
|
+
let I = this[e(225)][0][e(195)], T = this[e(225)][0][e(226)];
|
|
49
|
+
const l = t[e(233)] && t[e(214)];
|
|
50
|
+
var p = globalThis.hinnn.mm[e(206)](t[e(233)] || I), S = globalThis.hinnn.mm[e(206)](t[e(214)] || T), u = globalThis.$[e(217)]({ backgroundColor: e(230) }, t || {});
|
|
51
|
+
const b = this[e(225)][0][e(196)], O = b != null && b != "" && b != e(231), q = this[e(221)](0) == 1 || l ? e(179) : e(211), E = O && !l ? b[e(188)]() : [p, S];
|
|
52
|
+
var v = new W({ orientation: q, unit: "pt", format: E }), _ = yield this[e(228)](a, t);
|
|
53
|
+
t && (t[e(215)] && (u.dpr = t[e(215)], u[e(204)] = t.pixelRatio), t.isDownload != null && (m = t[e(197)]), t[e(193)] != null && (f = t[e(193)])), globalThis.$(_).css(e(195), "")[e(194)](e(226), ""), this[e(223)]();
|
|
54
|
+
var P = this.getTempContainer();
|
|
55
|
+
this[e(210)](_, u), P[e(202)](_[0]), globalThis.$(_).css(e(241));
|
|
56
|
+
let A = P[e(198)](e(237))[e(190)];
|
|
57
|
+
this[e(201)](P, function() {
|
|
58
|
+
const s = e;
|
|
89
59
|
try {
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
globalThis[
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
})[
|
|
101
|
-
const
|
|
102
|
-
throw new Error(
|
|
60
|
+
P[s(198)](s(237))[s(218)](function(g, H) {
|
|
61
|
+
const c = s;
|
|
62
|
+
globalThis[c(239)].queue.add(function(j) {
|
|
63
|
+
const r = c;
|
|
64
|
+
U[r(178)](H, u)[r(199)](function(h) {
|
|
65
|
+
const i = r;
|
|
66
|
+
var L = h.getContext("2d");
|
|
67
|
+
L[i(207)] = !1;
|
|
68
|
+
var R = h[i(189)](i(242), u[i(192)] || 0.92);
|
|
69
|
+
v[i(222)](R, i(224), 0, 0, p, S), g < A - 1 && v.addPage(), f(g + 1, A), j();
|
|
70
|
+
})[r(191)]((h) => {
|
|
71
|
+
const i = r;
|
|
72
|
+
throw new Error(h[i(243)]);
|
|
103
73
|
});
|
|
104
|
-
}),
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
o[n(202)](), C[n(130)](t[n(182)]);
|
|
74
|
+
}), g == A - 1 && (globalThis[c(239)][c(186)][c(229)](function(j) {
|
|
75
|
+
const r = c;
|
|
76
|
+
if (m) o[r(180)](), v.save(t[r(232)]);
|
|
108
77
|
else {
|
|
109
|
-
o[
|
|
110
|
-
let
|
|
111
|
-
|
|
78
|
+
o[r(180)]();
|
|
79
|
+
let h = t.type || r(176), i = v[r(240)](h);
|
|
80
|
+
d[r(238)](i);
|
|
112
81
|
}
|
|
113
|
-
globalThis.hinnn[
|
|
114
|
-
}), globalThis[
|
|
82
|
+
globalThis.hinnn[r(186)][r(183)]();
|
|
83
|
+
}), globalThis[c(239)][c(186)][c(205)]());
|
|
115
84
|
});
|
|
116
|
-
} catch (
|
|
117
|
-
console[
|
|
85
|
+
} catch (g) {
|
|
86
|
+
console[s(187)](s(177)), console[s(209)](g);
|
|
118
87
|
}
|
|
119
88
|
});
|
|
120
89
|
}
|
|
121
|
-
return
|
|
90
|
+
return d[e(185)]();
|
|
122
91
|
});
|
|
123
92
|
};
|
|
124
|
-
function
|
|
125
|
-
const
|
|
126
|
-
return
|
|
127
|
-
return
|
|
128
|
-
},
|
|
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;
|
|
135
|
-
}
|
|
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>
|
|
140
|
-
.hiprint-printPanel-small{
|
|
141
|
-
box-sizing: border-box;
|
|
142
|
-
border: 0px;
|
|
143
|
-
}
|
|
144
|
-
.hiprint-printPaper-small{
|
|
145
|
-
position: relative;
|
|
146
|
-
padding: 0;
|
|
147
|
-
}
|
|
148
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
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();
|
|
93
|
+
function y(a, n) {
|
|
94
|
+
const x = w();
|
|
95
|
+
return y = function(e, o) {
|
|
96
|
+
return e = e - 175, x[e];
|
|
97
|
+
}, y(a, n);
|
|
153
98
|
}
|
|
154
|
-
(function(
|
|
155
|
-
for (var
|
|
99
|
+
(function(a, n) {
|
|
100
|
+
for (var x = k, e = a(); ; )
|
|
156
101
|
try {
|
|
157
|
-
var o = parseInt(
|
|
158
|
-
if (o ===
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
x.push(x.shift());
|
|
102
|
+
var o = parseInt(x(110)) / 1 + -parseInt(x(108)) / 2 * (parseInt(x(113)) / 3) + parseInt(x(115)) / 4 * (-parseInt(x(114)) / 5) + -parseInt(x(112)) / 6 + parseInt(x(109)) / 7 + -parseInt(x(111)) / 8 * (parseInt(x(119)) / 9) + parseInt(x(121)) / 10;
|
|
103
|
+
if (o === n) break;
|
|
104
|
+
e.push(e.shift());
|
|
105
|
+
} catch (d) {
|
|
106
|
+
e.push(e.shift());
|
|
163
107
|
}
|
|
164
|
-
})(
|
|
165
|
-
function
|
|
166
|
-
var
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
108
|
+
})(C, 452171);
|
|
109
|
+
function k(a, n) {
|
|
110
|
+
var x = C();
|
|
111
|
+
return k = function(e, o) {
|
|
112
|
+
e = e - 107;
|
|
113
|
+
var d = x[e];
|
|
114
|
+
return d;
|
|
115
|
+
}, k(a, n);
|
|
170
116
|
}
|
|
171
|
-
function
|
|
172
|
-
var
|
|
173
|
-
return
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}, j(i, e);
|
|
117
|
+
function $(a) {
|
|
118
|
+
var n = k;
|
|
119
|
+
return { name: n(120), description: "add toPdf Api", hooks: [{ hook: "newPrintTemplate", name: "add toPdf Api to PrintTemplate", description: n(118), priority: 1, run: ({ template: x, options: e }) => {
|
|
120
|
+
var o = n;
|
|
121
|
+
Object[o(107)](x, o(116), { value: F, enumerable: !1, writable: !0, configurable: !0 });
|
|
122
|
+
} }], leastHiprintVersion: n(117) };
|
|
178
123
|
}
|
|
179
|
-
function
|
|
180
|
-
var
|
|
181
|
-
return
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
} }], leastHiprintVersion: e(273) };
|
|
124
|
+
function C() {
|
|
125
|
+
var a = ["add toPdf Api", "9333550RwXQdP", "defineProperty", "312718ZVTmse", "539938NUAttv", "824089SpfuXz", "40TnvvPr", "1473846SJXJZg", "6WFTWOY", "161065QkcmVK", "44xZTOUo", "toPdf", "0.3.0", "add toPdf Api to PrintTemplate", "845469rygPpW"];
|
|
126
|
+
return C = function() {
|
|
127
|
+
return a;
|
|
128
|
+
}, C();
|
|
185
129
|
}
|
|
186
130
|
export {
|
|
187
|
-
|
|
131
|
+
$ as default
|
|
188
132
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
}
|
|
3
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
|
-
display:inline-block;
|
|
5
|
-
padding: `+(Number(r[x(132)])||0)/2+"mm "+(Number(r.layoutColumnGap)||0)/2+x(185)):p[x(168)](`<style>
|
|
6
|
-
.hiprint-printPanel-small{
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
border: 0px;
|
|
9
|
-
}
|
|
10
|
-
.hiprint-printPaper-small{
|
|
11
|
-
position: relative;
|
|
12
|
-
padding: 0;
|
|
13
|
-
}
|
|
14
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-wrap: wrap;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
align-content: flex-start;
|
|
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;
|
|
23
|
-
}
|
|
24
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
25
|
-
display:inline-block;
|
|
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>
|
|
28
|
-
.hiprint-printPanel-small{
|
|
29
|
-
box-sizing: border-box;
|
|
30
|
-
border: 0px;
|
|
31
|
-
}
|
|
32
|
-
.hiprint-printPaper-small{
|
|
33
|
-
position: relative;
|
|
34
|
-
padding: 0;
|
|
35
|
-
}
|
|
36
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
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});
|
|
1
|
+
(function(s,l){typeof exports=="object"&&typeof module!="undefined"?module.exports=l(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],l):(s=typeof globalThis!="undefined"?globalThis:s||self,s.pluginApiPdf=l(s.window,s.jspdf))})(this,function(s,l){"use strict";var H=(s,l,c)=>new Promise((k,u)=>{var b=t=>{try{p(c.next(t))}catch(n){u(n)}},A=t=>{try{p(c.throw(t))}catch(n){u(n)}},p=t=>t.done?k(t.value):Promise.resolve(t.value).then(b,A);p((c=c.apply(s,l)).next())});(function(t,n){const x=u,e=t();for(;;)try{if(-parseInt(x(181))/1*(-parseInt(x(219))/2)+parseInt(x(213))/3+-parseInt(x(220))/4*(parseInt(x(212))/5)+-parseInt(x(200))/6*(parseInt(x(182))/7)+parseInt(x(227))/8+parseInt(x(203))/9+-parseInt(x(184))/10===n)break;e.push(e.shift())}catch(i){e.push(e.shift())}})(c,998909);function c(){const t=["3358983pLJjpl","paperHeight","pixelRatio","Deferred","extend","each","108cpHUHk","152tMUSqg","getOrient","addImage","createTempContainer","JPEG","printPanels","height","2738168EjIhWV","getHtml","add","#fff","自定义","name","paperWidth",".pdf","toPdf percent: ","floor",".hiprint-printPanel .hiprint-printPaper","resolve","hinnn","output","position:fixed","image/jpeg","message","indexOf","blob","toPdf 失败(可能您的图片资源无法正常加载): ","toCanvas","portrait","removeTempContainer","25766FaCiRS","455518znuvMt","clear","29328650AEjNPL","promise","queue","error","toLocaleLowerCase","toDataURL","length","catch","quality","onProgress","css","width","paperType","isDownload","find","then","12OdchtS","loadAllImages","html","11243232ZnkyFS","scale","run","toPt","imageSmoothingEnabled","now","log","svg2canvas","landscape","5345BKGGqa"];return c=function(){return t},c()}const k=function(t,n,x){return H(this,null,function*(){const e=u;var i=this,h=globalThis.$[e(216)](),q=!0;let S=(y,j)=>{const m=e,g=Math[m(236)](y/j*100);console[m(209)]("cur",y,"total",j),console.log(m(235),g+"%")},a=x||{};if(this[e(225)].length){if(typeof n=="string"){const d=n[e(175)](e(234))>-1?n:n+e(234);a[e(232)]=d}else a=n||{},!a.name&&(a.name="sv-print-"+Date[e(208)]()+e(234));let y=this[e(225)][0][e(195)],j=this[e(225)][0][e(226)];const m=a[e(233)]&&a[e(214)];var D=globalThis.hinnn.mm[e(206)](a[e(233)]||y),O=globalThis.hinnn.mm[e(206)](a[e(214)]||j),_=globalThis.$[e(217)]({backgroundColor:e(230)},a||{});const g=this[e(225)][0][e(196)],L=g!=null&&g!=""&&g!=e(231),R=this[e(221)](0)==1||m?e(179):e(211),U=L&&!m?g[e(188)]():[D,O];var I=new l.jsPDF({orientation:R,unit:"pt",format:U}),T=yield this[e(228)](t,a);a&&(a[e(215)]&&(_.dpr=a[e(215)],_[e(204)]=a.pixelRatio),a.isDownload!=null&&(q=a[e(197)]),a[e(193)]!=null&&(S=a[e(193)])),globalThis.$(T).css(e(195),"")[e(194)](e(226),""),this[e(223)]();var w=this.getTempContainer();this[e(210)](T,_),w[e(202)](T[0]),globalThis.$(T).css(e(241));let C=w[e(198)](e(237))[e(190)];this[e(201)](w,function(){const d=e;try{w[d(198)](d(237))[d(218)](function(P,W){const f=d;globalThis[f(239)].queue.add(function(E){const o=f;s.snapdom[o(178)](W,_)[o(199)](function(v){const r=o;var z=v.getContext("2d");z[r(207)]=!1;var F=v[r(189)](r(242),_[r(192)]||.92);I[r(222)](F,r(224),0,0,D,O),P<C-1&&I.addPage(),S(P+1,C),E()})[o(191)](v=>{const r=o;throw new Error(v[r(243)])})}),P==C-1&&(globalThis[f(239)][f(186)][f(229)](function(E){const o=f;if(q)i[o(180)](),I.save(a[o(232)]);else{i[o(180)]();let v=a.type||o(176),r=I[o(240)](v);h[o(238)](r)}globalThis.hinnn[o(186)][o(183)]()}),globalThis[f(239)][f(186)][f(205)]())})}catch(P){console[d(187)](d(177)),console[d(209)](P)}})}return h[e(185)]()})};function u(t,n){const x=c();return u=function(e,i){return e=e-175,x[e]},u(t,n)}(function(t,n){for(var x=b,e=t();;)try{var i=parseInt(x(110))/1+-parseInt(x(108))/2*(parseInt(x(113))/3)+parseInt(x(115))/4*(-parseInt(x(114))/5)+-parseInt(x(112))/6+parseInt(x(109))/7+-parseInt(x(111))/8*(parseInt(x(119))/9)+parseInt(x(121))/10;if(i===n)break;e.push(e.shift())}catch(h){e.push(e.shift())}})(p,452171);function b(t,n){var x=p();return b=function(e,i){e=e-107;var h=x[e];return h},b(t,n)}function A(t){var n=b;return{name:n(120),description:"add toPdf Api",hooks:[{hook:"newPrintTemplate",name:"add toPdf Api to PrintTemplate",description:n(118),priority:1,run:({template:x,options:e})=>{var i=n;Object[i(107)](x,i(116),{value:k,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(117)}}function p(){var t=["add toPdf Api","9333550RwXQdP","defineProperty","312718ZVTmse","539938NUAttv","824089SpfuXz","40TnvvPr","1473846SJXJZg","6WFTWOY","161065QkcmVK","44xZTOUo","toPdf","0.3.0","add toPdf Api to PrintTemplate","845469rygPpW"];return p=function(){return t},p()}return A});
|