@sv-print/plugin-api-pdf 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 -39
- package/dist/index.mjs +105 -163
- package/dist/index.umd.js +1 -39
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,39 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
}
|
|
3
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
|
-
display:inline-block;
|
|
5
|
-
padding: `+(Number(i[x(141)])||0)/2+x(163)+(Number(i.layoutColumnGap)||0)/2+x(185)):o[x(129)](`<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(i[x(141)])||0)/2+x(184)+(Number(i.layoutColumnGap)||0)/2+`mm;
|
|
20
|
-
}
|
|
21
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
22
|
-
display:inline-block;
|
|
23
|
-
padding: `+(Number(i.layoutRowGap)||0)/2+x(163)+(Number(i[x(197)])||0)/2+`mm;
|
|
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>
|
|
29
|
-
.hiprint-printPanel-small{
|
|
30
|
-
box-sizing: border-box;
|
|
31
|
-
border: 0px;
|
|
32
|
-
}
|
|
33
|
-
.hiprint-printPaper-small{
|
|
34
|
-
position: relative;
|
|
35
|
-
padding: 0;
|
|
36
|
-
}
|
|
37
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
38
|
-
margin: -`,"type","append","floor","name",".hiprint-printPaper","scale","dpr","toCanvas","clone","77065jTGfOx","removeClass","931212VmjolX","3493qiKaXV","layoutRowGap","getOrient",`<div class="hiprint-printPanel">
|
|
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;
|
|
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,190 +1,132 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var D = (a, n, x) => new Promise((e, o) => {
|
|
2
|
+
var d = (t) => {
|
|
3
3
|
try {
|
|
4
|
-
f(
|
|
5
|
-
} catch (
|
|
6
|
-
p
|
|
4
|
+
f(x.next(t));
|
|
5
|
+
} catch (p) {
|
|
6
|
+
o(p);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, m = (t) => {
|
|
9
9
|
try {
|
|
10
|
-
f(
|
|
11
|
-
} catch (
|
|
12
|
-
p
|
|
10
|
+
f(x.throw(t));
|
|
11
|
+
} catch (p) {
|
|
12
|
+
o(p);
|
|
13
13
|
}
|
|
14
|
-
}, f = (t) => t.done ?
|
|
15
|
-
f((
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
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());
|
|
25
|
+
} catch (o) {
|
|
26
|
+
e.push(e.shift());
|
|
28
27
|
}
|
|
29
|
-
})(
|
|
30
|
-
function
|
|
31
|
-
const a =
|
|
32
|
-
return
|
|
33
|
-
return
|
|
34
|
-
},
|
|
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();
|
|
35
34
|
}
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
const
|
|
39
|
-
var
|
|
40
|
-
let f = (
|
|
41
|
-
const
|
|
42
|
-
console[
|
|
43
|
-
}, t =
|
|
44
|
-
if (this[
|
|
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) {
|
|
45
44
|
if (typeof n == "string") {
|
|
46
|
-
const
|
|
47
|
-
t[
|
|
48
|
-
} else
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
const
|
|
53
|
-
var
|
|
54
|
-
t && (t[
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
i.layoutType == x(171) ? s.append(x(127) + (Number(i[x(141)]) || 0) / 2 + x(184) + (Number(i[x(197)]) || 0) / 2 + `mm;
|
|
61
|
-
}
|
|
62
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
63
|
-
display:inline-block;
|
|
64
|
-
padding: ` + (Number(i[x(141)]) || 0) / 2 + x(163) + (Number(i.layoutColumnGap) || 0) / 2 + x(185)) : s[x(129)](`<style>
|
|
65
|
-
.hiprint-printPanel-small{
|
|
66
|
-
box-sizing: border-box;
|
|
67
|
-
border: 0px;
|
|
68
|
-
}
|
|
69
|
-
.hiprint-printPaper-small{
|
|
70
|
-
position: relative;
|
|
71
|
-
padding: 0;
|
|
72
|
-
}
|
|
73
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
74
|
-
display: flex;
|
|
75
|
-
flex-wrap: wrap;
|
|
76
|
-
flex-direction: column;
|
|
77
|
-
align-content: flex-start;
|
|
78
|
-
margin: -` + (Number(i[x(141)]) || 0) / 2 + x(184) + (Number(i.layoutColumnGap) || 0) / 2 + `mm;
|
|
79
|
-
}
|
|
80
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
81
|
-
display:inline-block;
|
|
82
|
-
padding: ` + (Number(i.layoutRowGap) || 0) / 2 + x(163) + (Number(i[x(197)]) || 0) / 2 + `mm;
|
|
83
|
-
}
|
|
84
|
-
</style>`);
|
|
85
|
-
for (let o = 0; o < r; o++) {
|
|
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);
|
|
92
|
-
}
|
|
93
|
-
s[x(129)](G);
|
|
94
|
-
}
|
|
95
|
-
this.svg2canvas(s, u), C[x(200)](s[0]), globalThis.$(s).css(x(164));
|
|
96
|
-
} else
|
|
97
|
-
this[x(123)](g, u), C[x(200)](g[0]), globalThis.$(g)[x(148)](x(164));
|
|
98
|
-
let $ = C[x(149)](x(189)).length;
|
|
99
|
-
this.loadAllImages(g, function() {
|
|
100
|
-
const d = x;
|
|
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;
|
|
101
59
|
try {
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
globalThis.
|
|
105
|
-
const r =
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
var
|
|
109
|
-
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
})[r(
|
|
113
|
-
const
|
|
114
|
-
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)]);
|
|
115
73
|
});
|
|
116
|
-
}),
|
|
117
|
-
const r =
|
|
118
|
-
if (
|
|
119
|
-
p[r(155)](), w[r(166)](t.name);
|
|
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)]);
|
|
120
77
|
else {
|
|
121
|
-
|
|
122
|
-
let
|
|
123
|
-
|
|
78
|
+
o[r(180)]();
|
|
79
|
+
let h = t.type || r(176), i = v[r(240)](h);
|
|
80
|
+
d[r(238)](i);
|
|
124
81
|
}
|
|
125
|
-
globalThis[r(
|
|
126
|
-
}), globalThis[
|
|
82
|
+
globalThis.hinnn[r(186)][r(183)]();
|
|
83
|
+
}), globalThis[c(239)][c(186)][c(205)]());
|
|
127
84
|
});
|
|
128
|
-
} catch (
|
|
129
|
-
console
|
|
85
|
+
} catch (g) {
|
|
86
|
+
console[s(187)](s(177)), console[s(209)](g);
|
|
130
87
|
}
|
|
131
88
|
});
|
|
132
89
|
}
|
|
133
|
-
return
|
|
90
|
+
return d[e(185)]();
|
|
134
91
|
});
|
|
135
92
|
};
|
|
136
|
-
function
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
.hiprint-printPanel-small{
|
|
142
|
-
box-sizing: border-box;
|
|
143
|
-
border: 0px;
|
|
144
|
-
}
|
|
145
|
-
.hiprint-printPaper-small{
|
|
146
|
-
position: relative;
|
|
147
|
-
padding: 0;
|
|
148
|
-
}
|
|
149
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
150
|
-
margin: -`, "type", "append", "floor", "name", ".hiprint-printPaper", "scale", "dpr", "toCanvas", "clone", "77065jTGfOx", "removeClass", "931212VmjolX", "3493qiKaXV", "layoutRowGap", "getOrient", `<div class="hiprint-printPanel">
|
|
151
|
-
<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"];
|
|
152
|
-
return N = function() {
|
|
153
|
-
return e;
|
|
154
|
-
}, N();
|
|
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);
|
|
155
98
|
}
|
|
156
|
-
(function(
|
|
157
|
-
for (var
|
|
99
|
+
(function(a, n) {
|
|
100
|
+
for (var x = k, e = a(); ; )
|
|
158
101
|
try {
|
|
159
|
-
var
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
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());
|
|
165
107
|
}
|
|
166
|
-
})(
|
|
167
|
-
function
|
|
168
|
-
var
|
|
169
|
-
return
|
|
170
|
-
|
|
171
|
-
|
|
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);
|
|
172
116
|
}
|
|
173
|
-
function
|
|
174
|
-
var
|
|
175
|
-
return
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}, q(e, n);
|
|
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) };
|
|
180
123
|
}
|
|
181
|
-
function
|
|
182
|
-
var
|
|
183
|
-
return
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
} }], leastHiprintVersion: "0.3.0" };
|
|
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();
|
|
187
129
|
}
|
|
188
130
|
export {
|
|
189
|
-
|
|
131
|
+
$ as default
|
|
190
132
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,39 +1 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
}
|
|
3
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
|
-
display:inline-block;
|
|
5
|
-
padding: `+(Number(i[x(141)])||0)/2+x(163)+(Number(i.layoutColumnGap)||0)/2+x(185)):s[x(129)](`<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(i[x(141)])||0)/2+x(184)+(Number(i.layoutColumnGap)||0)/2+`mm;
|
|
20
|
-
}
|
|
21
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
22
|
-
display:inline-block;
|
|
23
|
-
padding: `+(Number(i.layoutRowGap)||0)/2+x(163)+(Number(i[x(197)])||0)/2+`mm;
|
|
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>
|
|
29
|
-
.hiprint-printPanel-small{
|
|
30
|
-
box-sizing: border-box;
|
|
31
|
-
border: 0px;
|
|
32
|
-
}
|
|
33
|
-
.hiprint-printPaper-small{
|
|
34
|
-
position: relative;
|
|
35
|
-
padding: 0;
|
|
36
|
-
}
|
|
37
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
38
|
-
margin: -`,"type","append","floor","name",".hiprint-printPaper","scale","dpr","toCanvas","clone","77065jTGfOx","removeClass","931212VmjolX","3493qiKaXV","layoutRowGap","getOrient",`<div class="hiprint-printPanel">
|
|
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});
|
|
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});
|