@sv-print/plugin-api-pdf3 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 +104 -161
- 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
|
-
<div class="hiprint-printPaper" style="width:`,"log","8PTQNAi","hinnn","6KkqdMM","mm;height:","height","toPt","save","addImage","56fzgXvZ","then",".hiprint-printPaper","2421405iFSuvo","toDataURL","dpr","css","JPEG","paperHeight","\u81EA\u5B9A\u4E49","append","pixelRatio",`mm;"></div>
|
|
3
|
-
</div>`,"63397avRfSw","mm ","floor","8iPKQQR","row","clear","createTempContainer","run","image/jpeg",`mm;
|
|
4
|
-
}
|
|
5
|
-
</style>`,"mm -","blob","getTempContainer","type",`mm;
|
|
6
|
-
}
|
|
7
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
8
|
-
display:inline-block;
|
|
9
|
-
padding: `,"cur","onProgress"];return N=function(){return n},N()}function y(n,e){const a=N();return y=function(x,o){return x=x-259,a[x]},y(n,e)}const H=function(n,e,a){return q(this,null,function*(){const x=y;var o=this,h=globalThis.$.Deferred(),w=!![];let b=(P,_)=>{const d=y,i=Math.floor(P/_*100);console.log(d(334),P,d(272),_),console[d(297)](d(292),i+"%")},t=a||{};if(this.printPanels[x(274)]){if(typeof e=="string"){const c=e[x(346)](x(294))>-1?e:e+x(294);t[x(283)]=c}else t=e||{},!t.name&&(t[x(283)]=x(277)+Date[x(338)]()+x(294));let P=this[x(343)][0].width,_=this[x(343)][0][x(302)];var m=globalThis[x(299)].mm[x(303)](t[x(285)]||P),A=globalThis.hinnn.mm[x(303)](t[x(314)]||_),u=globalThis.$.extend({},t||{});const d=this[x(343)][0][x(259)],i=this[x(343)][0][x(264)],O=i&&(i[x(290)]>0||i[x(281)]>0),z=d!=null&&d!=""&&d!=x(315);var C=new E.jsPDF({orientation:this[x(263)](0)==1?"portrait":"landscape",unit:"pt",format:z?d[x(291)]():[m,A]}),g=yield this[x(293)](n,t);t&&(t.pixelRatio&&(u[x(311)]=t[x(317)],u[x(336)]=t.pixelRatio),t[x(295)]!=null&&(w=t[x(295)]),t[x(335)]!=null&&(b=t[x(335)])),globalThis.$(g)[x(312)](x(276),"")[x(312)](x(302),""),this[x(325)]();var v=this[x(331)]();if(O&&t.paperWidth&&t.paperHeight){let c=Math.floor(t[x(285)]/(P+i.layoutRowGap/2)),f=Math[x(321)](t[x(314)]/(_+i[x(281)]/2));const T=c*f,s=g[x(342)](x(337)),I=s[x(274)],p=Math[x(339)](I/T);let l=globalThis.$('<div class="hiprint-printTemplate"></div>');i[x(282)]==x(323)?l.append(`<style>
|
|
10
|
-
.hiprint-printPanel-small{
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
border: 0px;
|
|
13
|
-
}
|
|
14
|
-
.hiprint-printPaper-small{
|
|
15
|
-
position: relative;
|
|
16
|
-
padding: 0;
|
|
17
|
-
}
|
|
18
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
19
|
-
margin: -`+(Number(i[x(290)])||0)/2+x(329)+(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(320)+(Number(i.layoutColumnGap)||0)/2+x(328)):l[x(316)](`<style>
|
|
24
|
-
.hiprint-printPanel-small{
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
border: 0px;
|
|
27
|
-
}
|
|
28
|
-
.hiprint-printPaper-small{
|
|
29
|
-
position: relative;
|
|
30
|
-
padding: 0;
|
|
31
|
-
}
|
|
32
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-wrap: wrap;
|
|
35
|
-
flex-direction: column;
|
|
36
|
-
align-content: flex-start;
|
|
37
|
-
margin: -`+(Number(i[x(290)])||0)/2+"mm -"+(Number(i[x(281)])||0)/2+x(333)+(Number(i[x(290)])||0)/2+x(320)+(Number(i[x(281)])||0)/2+x(328));for(let r=0;r<p;r++){const M=globalThis.$(x(296)+t[x(285)]+x(301)+t[x(314)]+x(318)),j=r*T,L=Math[x(279)]((r+1)*T,I);for(let R=j;R<L;R++){const $=s.eq(R).clone();$[x(266)](x(271)),$[x(286)](x(268)+R);const K=globalThis.$(x(289));K[x(316)]($),M[x(342)](x(308))[x(316)](K)}l[x(316)](M)}this[x(345)](l,u),v[x(341)](l[0]),globalThis.$(l)[x(312)](x(269))}else this.svg2canvas(g,u),v[x(341)](g[0]),globalThis.$(g).css(x(269));let G=v[x(342)](x(337))[x(274)];this.loadAllImages(v,function(){const c=x;try{v[c(342)](c(337))[c(267)](function(f,T){const s=c;globalThis[s(299)][s(275)][s(284)](function(I){const p=s;Q.snapdom[p(270)](T,u)[p(307)](function(l){const r=p;var M=l[r(347)]("2d");M[r(262)]=![];var j=l[r(310)](r(327),u[r(265)]||.92);C[r(305)](j,r(313),0,0,m,A),f<G-1&&C.addPage(),b(f+1,G),I()}).catch(l=>{const r=p;throw new Error(l[r(278)])})}),f==G-1&&(globalThis[s(299)][s(275)][s(284)](function(I){const p=s;if(w)o.removeTempContainer(),C[p(304)](t.name);else{o.removeTempContainer();let l=t[p(332)]||p(330),r=C.output(l);h[p(260)](r)}globalThis[p(299)][p(275)][p(324)]()}),globalThis[s(299)][s(275)][s(326)]())})}catch(f){console[c(273)](c(348)),console[c(297)](f)}})}return h.promise()})};(function(n,e){for(var a=D,x=n();[];)try{var o=-parseInt(a(182))/1+parseInt(a(180))/2*(parseInt(a(177))/3)+-parseInt(a(168))/4*(-parseInt(a(175))/5)+-parseInt(a(178))/6+-parseInt(a(170))/7*(parseInt(a(169))/8)+-parseInt(a(167))/9+-parseInt(a(172))/10*(-parseInt(a(166))/11);if(o===e)break;x.push(x.shift())}catch(h){x.push(x.shift())}})(k,773925);function k(){var n=["7jWTMBh","defineProperty","10UxNSUv","toPdf","add toPdf Api to PrintTemplate","3468995hOTDPG","newPrintTemplate","135nlihLD","4820274JeKfwF","0.3.0","60578fPdzRk","add toPdf Api","85323GEkipK","9455402eKsIIR","8394813TXIBAD","8TjXBIM","8118408dNDtkM"];return k=function(){return n},k()}function D(n,e){var a=k();return D=function(x,o){x=x-166;var h=a[x];return h},D(n,e)}function S(n){var e=D;return{name:e(181),description:e(181),hooks:[{hook:e(176),name:e(174),description:"add toPdf Api to PrintTemplate",priority:1,run:({template:a,options:x})=>{var o=e;Object[o(171)](a,o(173),{value:H,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(179)}}module.exports=S;
|
|
1
|
+
"use strict";var k=(a,n,e)=>new Promise((x,r)=>{var p=t=>{try{l(e.next(t))}catch(f){r(f)}},m=t=>{try{l(e.throw(t))}catch(f){r(f)}},l=t=>t.done?x(t.value):Promise.resolve(t.value).then(p,m);l((e=e.apply(a,n)).next())});const B=require("@zumer/snapdom"),H=require("jspdf");(function(a,n){const e=q,x=a();for(;;)try{if(-parseInt(e(364))/1*(-parseInt(e(353))/2)+-parseInt(e(341))/3*(parseInt(e(378))/4)+parseInt(e(347))/5+parseInt(e(351))/6*(parseInt(e(369))/7)+parseInt(e(371))/8+-parseInt(e(374))/9+-parseInt(e(352))/10*(parseInt(e(334))/11)===n)break;x.push(x.shift())}catch(r){x.push(x.shift())}})(w,319677);const W=function(a,n,e){return k(this,null,function*(){const x=q;var r=this,p=globalThis.$[x(340)](),m=!0;let l=(P,T)=>{const c=x,d=Math[c(361)](P/T*100);console[c(319)](c(377),P,"total",T),console[c(319)](c(372),d+"%")},t=e||{};if(this[x(382)][x(327)]){if(typeof n===x(375)){const o=n[x(367)](x(365))>-1?n:n+x(365);t[x(360)]=o}else t=n||{},!t[x(360)]&&(t.name=x(362)+Date[x(344)]()+x(365));let P=this[x(382)][0][x(333)],T=this[x(382)][0][x(348)];const c=t[x(343)]&&t[x(330)];var f=globalThis[x(363)].mm[x(323)](t[x(343)]||P),C=globalThis.hinnn.mm[x(323)](t[x(330)]||T),u=globalThis.$[x(338)]({backgroundColor:x(329)},t||{});const d=this[x(382)][0][x(335)],R=d!=null&&d!=""&&d!=x(376),X=this[x(321)](0)==1||c?x(328):"landscape",E=R&&!c?d[x(332)]():[f,C];var v=new H.jsPDF({orientation:X,unit:"pt",format:E}),_=yield this.getHtml(a,t);t&&(t[x(326)]&&(u[x(346)]=t.pixelRatio,u[x(368)]=t[x(326)]),t[x(379)]!=null&&(m=t[x(379)]),t[x(336)]!=null&&(l=t[x(336)])),globalThis.$(_)[x(355)]("width","")[x(355)](x(348),""),this[x(325)]();var I=this[x(342)]();this[x(331)](_,u),I[x(337)](_[0]),globalThis.$(_)[x(355)](x(324));let A=I[x(354)](x(381)).length;this[x(370)](I,function(){const o=x;try{I[o(354)](o(381))[o(345)](function(b,G){const i=o;globalThis[i(363)][i(322)][i(358)](function(j){const s=i;B.snapdom.toCanvas(G,u)[s(318)](function(h){const g=s;var O=h[g(366)]("2d");O[g(356)]=!1;var Z=h.toDataURL("image/jpeg",u.quality||.92);v.addImage(Z,g(320),0,0,f,C),b<A-1&&v.addPage(),l(b+1,A),j()})[s(350)](h=>{throw new Error(h.message)})}),b==A-1&&(globalThis.hinnn.queue[i(358)](function(j){const s=i;if(m)r.removeTempContainer(),v[s(349)](t[s(360)]);else{r[s(359)]();let h=t[s(373)]||"blob",g=v.output(h);p.resolve(g)}globalThis[s(363)].queue.clear()}),globalThis[i(363)][i(322)][i(380)]())})}catch(b){console[o(339)](o(357)),console[o(319)](b)}})}return p.promise()})};function q(a,n){const e=w();return q=function(x,r){return x=x-318,e[x]},q(a,n)}function w(){const a=["save","catch","1270116jXYvDl","10isvtQq","134FXOcys","find","css","imageSmoothingEnabled","toPdf 失败(可能您的图片资源无法正常加载): ","add","removeTempContainer","name","floor","sv-print-","hinnn","2913lJqTSb",".pdf","getContext","indexOf","scale","7ephwfs","loadAllImages","2436640DEXpzD","toPdf percent: ","type","4154787eMEquO","string","自定义","cur","11468BswBuP","isDownload","run",".hiprint-printPanel .hiprint-printPaper","printPanels","then","log","JPEG","getOrient","queue","toPt","position:fixed","createTempContainer","pixelRatio","length","portrait","#fff","paperHeight","svg2canvas","toLocaleLowerCase","width","565334qhgZZz","paperType","onProgress","html","extend","error","Deferred","183uXkDZV","getTempContainer","paperWidth","now","each","dpr","1480820qWimoZ","height"];return w=function(){return a},w()}function y(){var a=["2979GBpDqr","add toPdf Api","4575935rhWZqJ","918DcynHl","toPdf","1523658KGpjTG","defineProperty","1531140yqUKYr","46392ARDXSt","230qAbAyB","newPrintTemplate","5242002lfWGRM","2950684ipXaaP","5TaYwDD","0.3.0","add toPdf Api to PrintTemplate","176VhqARN"];return y=function(){return a},y()}(function(a,n){for(var e=D,x=a();;)try{var r=-parseInt(e(324))/1*(parseInt(e(316))/2)+-parseInt(e(329))/3+-parseInt(e(319))/4+-parseInt(e(320))/5*(-parseInt(e(318))/6)+-parseInt(e(326))/7+parseInt(e(315))/8*(-parseInt(e(327))/9)+-parseInt(e(314))/10*(-parseInt(e(323))/11);if(r===n)break;x.push(x.shift())}catch(p){x.push(x.shift())}})(y,490146);function D(a,n){var e=y();return D=function(x,r){x=x-314;var p=e[x];return p},D(a,n)}function $(a){var n=D;return{name:n(325),description:"add toPdf Api",hooks:[{hook:n(317),name:n(322),description:n(322),priority:1,run:({template:e,options:x})=>{var r=n;Object[r(330)](e,r(328),{value:W,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(321)}}module.exports=$;
|
package/dist/index.mjs
CHANGED
|
@@ -1,188 +1,131 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var R = (a, n, t) => new Promise((x, r) => {
|
|
2
|
+
var p = (e) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
4
|
+
c(t.next(e));
|
|
5
|
+
} catch (f) {
|
|
6
|
+
r(f);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, m = (e) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
10
|
+
c(t.throw(e));
|
|
11
|
+
} catch (f) {
|
|
12
|
+
r(f);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, c = (e) => e.done ? x(e.value) : Promise.resolve(e.value).then(p, m);
|
|
15
|
+
c((t = t.apply(a, n)).next());
|
|
16
16
|
});
|
|
17
|
-
import { snapdom as
|
|
18
|
-
import { jsPDF as
|
|
19
|
-
(function(
|
|
20
|
-
const
|
|
21
|
-
for (;
|
|
17
|
+
import { snapdom as B } from "@zumer/snapdom";
|
|
18
|
+
import { jsPDF as H } from "jspdf";
|
|
19
|
+
(function(a, n) {
|
|
20
|
+
const t = w, x = a();
|
|
21
|
+
for (; ; )
|
|
22
22
|
try {
|
|
23
|
-
if (-parseInt(
|
|
24
|
-
break;
|
|
23
|
+
if (-parseInt(t(364)) / 1 * (-parseInt(t(353)) / 2) + -parseInt(t(341)) / 3 * (parseInt(t(378)) / 4) + parseInt(t(347)) / 5 + parseInt(t(351)) / 6 * (parseInt(t(369)) / 7) + parseInt(t(371)) / 8 + -parseInt(t(374)) / 9 + -parseInt(t(352)) / 10 * (parseInt(t(334)) / 11) === n) break;
|
|
25
24
|
x.push(x.shift());
|
|
26
|
-
} catch (
|
|
25
|
+
} catch (r) {
|
|
27
26
|
x.push(x.shift());
|
|
28
27
|
}
|
|
29
|
-
})(
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
let b = (P, _) => {
|
|
55
|
-
const d = y, i = Math.floor(P / _ * 100);
|
|
56
|
-
console.log(d(334), P, d(272), _), console[d(297)](d(292), i + "%");
|
|
57
|
-
}, t = a || {};
|
|
58
|
-
if (this.printPanels[x(274)]) {
|
|
59
|
-
if (typeof e == "string") {
|
|
60
|
-
const c = e[x(346)](x(294)) > -1 ? e : e + x(294);
|
|
61
|
-
t[x(283)] = c;
|
|
62
|
-
} else
|
|
63
|
-
t = e || {}, !t.name && (t[x(283)] = x(277) + Date[x(338)]() + x(294));
|
|
64
|
-
let P = this[x(343)][0].width, _ = this[x(343)][0][x(302)];
|
|
65
|
-
var m = globalThis[x(299)].mm[x(303)](t[x(285)] || P), A = globalThis.hinnn.mm[x(303)](t[x(314)] || _), u = globalThis.$.extend({}, t || {});
|
|
66
|
-
const d = this[x(343)][0][x(259)], i = this[x(343)][0][x(264)], L = i && (i[x(290)] > 0 || i[x(281)] > 0), Q = d != null && d != "" && d != x(315);
|
|
67
|
-
var C = new E({ orientation: this[x(263)](0) == 1 ? "portrait" : "landscape", unit: "pt", format: Q ? d[x(291)]() : [m, A] }), g = yield this[x(293)](n, t);
|
|
68
|
-
t && (t.pixelRatio && (u[x(311)] = t[x(317)], u[x(336)] = t.pixelRatio), t[x(295)] != null && (w = t[x(295)]), t[x(335)] != null && (b = t[x(335)])), globalThis.$(g)[x(312)](x(276), "")[x(312)](x(302), ""), this[x(325)]();
|
|
69
|
-
var v = this[x(331)]();
|
|
70
|
-
if (L && t.paperWidth && t.paperHeight) {
|
|
71
|
-
let c = Math.floor(t[x(285)] / (P + i.layoutRowGap / 2)), f = Math[x(321)](t[x(314)] / (_ + i[x(281)] / 2));
|
|
72
|
-
const T = c * f, p = g[x(342)](x(337)), I = p[x(274)], s = Math[x(339)](I / T);
|
|
73
|
-
let l = globalThis.$('<div class="hiprint-printTemplate"></div>');
|
|
74
|
-
i[x(282)] == x(323) ? l.append(`<style>
|
|
75
|
-
.hiprint-printPanel-small{
|
|
76
|
-
box-sizing: border-box;
|
|
77
|
-
border: 0px;
|
|
78
|
-
}
|
|
79
|
-
.hiprint-printPaper-small{
|
|
80
|
-
position: relative;
|
|
81
|
-
padding: 0;
|
|
82
|
-
}
|
|
83
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
84
|
-
margin: -` + (Number(i[x(290)]) || 0) / 2 + x(329) + (Number(i.layoutColumnGap) || 0) / 2 + `mm;
|
|
85
|
-
}
|
|
86
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
87
|
-
display:inline-block;
|
|
88
|
-
padding: ` + (Number(i.layoutRowGap) || 0) / 2 + x(320) + (Number(i.layoutColumnGap) || 0) / 2 + x(328)) : l[x(316)](`<style>
|
|
89
|
-
.hiprint-printPanel-small{
|
|
90
|
-
box-sizing: border-box;
|
|
91
|
-
border: 0px;
|
|
92
|
-
}
|
|
93
|
-
.hiprint-printPaper-small{
|
|
94
|
-
position: relative;
|
|
95
|
-
padding: 0;
|
|
96
|
-
}
|
|
97
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
98
|
-
display: flex;
|
|
99
|
-
flex-wrap: wrap;
|
|
100
|
-
flex-direction: column;
|
|
101
|
-
align-content: flex-start;
|
|
102
|
-
margin: -` + (Number(i[x(290)]) || 0) / 2 + "mm -" + (Number(i[x(281)]) || 0) / 2 + x(333) + (Number(i[x(290)]) || 0) / 2 + x(320) + (Number(i[x(281)]) || 0) / 2 + x(328));
|
|
103
|
-
for (let r = 0; r < s; r++) {
|
|
104
|
-
const M = globalThis.$(x(296) + t[x(285)] + x(301) + t[x(314)] + x(318)), $ = r * T, q = Math[x(279)]((r + 1) * T, I);
|
|
105
|
-
for (let R = $; R < q; R++) {
|
|
106
|
-
const j = p.eq(R).clone();
|
|
107
|
-
j[x(266)](x(271)), j[x(286)](x(268) + R);
|
|
108
|
-
const K = globalThis.$(x(289));
|
|
109
|
-
K[x(316)](j), M[x(342)](x(308))[x(316)](K);
|
|
110
|
-
}
|
|
111
|
-
l[x(316)](M);
|
|
112
|
-
}
|
|
113
|
-
this[x(345)](l, u), v[x(341)](l[0]), globalThis.$(l)[x(312)](x(269));
|
|
114
|
-
} else
|
|
115
|
-
this.svg2canvas(g, u), v[x(341)](g[0]), globalThis.$(g).css(x(269));
|
|
116
|
-
let G = v[x(342)](x(337))[x(274)];
|
|
117
|
-
this.loadAllImages(v, function() {
|
|
118
|
-
const c = x;
|
|
28
|
+
})(q, 319677);
|
|
29
|
+
const W = function(a, n, t) {
|
|
30
|
+
return R(this, null, function* () {
|
|
31
|
+
const x = w;
|
|
32
|
+
var r = this, p = globalThis.$[x(340)](), m = !0;
|
|
33
|
+
let c = (P, T) => {
|
|
34
|
+
const l = x, h = Math[l(361)](P / T * 100);
|
|
35
|
+
console[l(319)](l(377), P, "total", T), console[l(319)](l(372), h + "%");
|
|
36
|
+
}, e = t || {};
|
|
37
|
+
if (this[x(382)][x(327)]) {
|
|
38
|
+
if (typeof n === x(375)) {
|
|
39
|
+
const o = n[x(367)](x(365)) > -1 ? n : n + x(365);
|
|
40
|
+
e[x(360)] = o;
|
|
41
|
+
} else e = n || {}, !e[x(360)] && (e.name = x(362) + Date[x(344)]() + x(365));
|
|
42
|
+
let P = this[x(382)][0][x(333)], T = this[x(382)][0][x(348)];
|
|
43
|
+
const l = e[x(343)] && e[x(330)];
|
|
44
|
+
var f = globalThis[x(363)].mm[x(323)](e[x(343)] || P), C = globalThis.hinnn.mm[x(323)](e[x(330)] || T), u = globalThis.$[x(338)]({ backgroundColor: x(329) }, e || {});
|
|
45
|
+
const h = this[x(382)][0][x(335)], X = h != null && h != "" && h != x(376), j = this[x(321)](0) == 1 || l ? x(328) : "landscape", E = X && !l ? h[x(332)]() : [f, C];
|
|
46
|
+
var v = new H({ orientation: j, unit: "pt", format: E }), _ = yield this.getHtml(a, e);
|
|
47
|
+
e && (e[x(326)] && (u[x(346)] = e.pixelRatio, u[x(368)] = e[x(326)]), e[x(379)] != null && (m = e[x(379)]), e[x(336)] != null && (c = e[x(336)])), globalThis.$(_)[x(355)]("width", "")[x(355)](x(348), ""), this[x(325)]();
|
|
48
|
+
var I = this[x(342)]();
|
|
49
|
+
this[x(331)](_, u), I[x(337)](_[0]), globalThis.$(_)[x(355)](x(324));
|
|
50
|
+
let A = I[x(354)](x(381)).length;
|
|
51
|
+
this[x(370)](I, function() {
|
|
52
|
+
const o = x;
|
|
119
53
|
try {
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
globalThis[
|
|
123
|
-
const s =
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
throw new Error(l[r(278)]);
|
|
54
|
+
I[o(354)](o(381))[o(345)](function(b, G) {
|
|
55
|
+
const i = o;
|
|
56
|
+
globalThis[i(363)][i(322)][i(358)](function(k) {
|
|
57
|
+
const s = i;
|
|
58
|
+
B.toCanvas(G, u)[s(318)](function(d) {
|
|
59
|
+
const g = s;
|
|
60
|
+
var O = d[g(366)]("2d");
|
|
61
|
+
O[g(356)] = !1;
|
|
62
|
+
var Z = d.toDataURL("image/jpeg", u.quality || 0.92);
|
|
63
|
+
v.addImage(Z, g(320), 0, 0, f, C), b < A - 1 && v.addPage(), c(b + 1, A), k();
|
|
64
|
+
})[s(350)]((d) => {
|
|
65
|
+
throw new Error(d.message);
|
|
133
66
|
});
|
|
134
|
-
}),
|
|
135
|
-
const s =
|
|
136
|
-
if (
|
|
137
|
-
o.removeTempContainer(), C[s(304)](t.name);
|
|
67
|
+
}), b == A - 1 && (globalThis.hinnn.queue[i(358)](function(k) {
|
|
68
|
+
const s = i;
|
|
69
|
+
if (m) r.removeTempContainer(), v[s(349)](e[s(360)]);
|
|
138
70
|
else {
|
|
139
|
-
|
|
140
|
-
let
|
|
141
|
-
|
|
71
|
+
r[s(359)]();
|
|
72
|
+
let d = e[s(373)] || "blob", g = v.output(d);
|
|
73
|
+
p.resolve(g);
|
|
142
74
|
}
|
|
143
|
-
globalThis[s(
|
|
144
|
-
}), globalThis[
|
|
75
|
+
globalThis[s(363)].queue.clear();
|
|
76
|
+
}), globalThis[i(363)][i(322)][i(380)]());
|
|
145
77
|
});
|
|
146
|
-
} catch (
|
|
147
|
-
console[
|
|
78
|
+
} catch (b) {
|
|
79
|
+
console[o(339)](o(357)), console[o(319)](b);
|
|
148
80
|
}
|
|
149
81
|
});
|
|
150
82
|
}
|
|
151
|
-
return
|
|
83
|
+
return p.promise();
|
|
152
84
|
});
|
|
153
85
|
};
|
|
154
|
-
|
|
155
|
-
|
|
86
|
+
function w(a, n) {
|
|
87
|
+
const t = q();
|
|
88
|
+
return w = function(x, r) {
|
|
89
|
+
return x = x - 318, t[x];
|
|
90
|
+
}, w(a, n);
|
|
91
|
+
}
|
|
92
|
+
function q() {
|
|
93
|
+
const a = ["save", "catch", "1270116jXYvDl", "10isvtQq", "134FXOcys", "find", "css", "imageSmoothingEnabled", "toPdf 失败(可能您的图片资源无法正常加载): ", "add", "removeTempContainer", "name", "floor", "sv-print-", "hinnn", "2913lJqTSb", ".pdf", "getContext", "indexOf", "scale", "7ephwfs", "loadAllImages", "2436640DEXpzD", "toPdf percent: ", "type", "4154787eMEquO", "string", "自定义", "cur", "11468BswBuP", "isDownload", "run", ".hiprint-printPanel .hiprint-printPaper", "printPanels", "then", "log", "JPEG", "getOrient", "queue", "toPt", "position:fixed", "createTempContainer", "pixelRatio", "length", "portrait", "#fff", "paperHeight", "svg2canvas", "toLocaleLowerCase", "width", "565334qhgZZz", "paperType", "onProgress", "html", "extend", "error", "Deferred", "183uXkDZV", "getTempContainer", "paperWidth", "now", "each", "dpr", "1480820qWimoZ", "height"];
|
|
94
|
+
return q = function() {
|
|
95
|
+
return a;
|
|
96
|
+
}, q();
|
|
97
|
+
}
|
|
98
|
+
function y() {
|
|
99
|
+
var a = ["2979GBpDqr", "add toPdf Api", "4575935rhWZqJ", "918DcynHl", "toPdf", "1523658KGpjTG", "defineProperty", "1531140yqUKYr", "46392ARDXSt", "230qAbAyB", "newPrintTemplate", "5242002lfWGRM", "2950684ipXaaP", "5TaYwDD", "0.3.0", "add toPdf Api to PrintTemplate", "176VhqARN"];
|
|
100
|
+
return y = function() {
|
|
101
|
+
return a;
|
|
102
|
+
}, y();
|
|
103
|
+
}
|
|
104
|
+
(function(a, n) {
|
|
105
|
+
for (var t = D, x = a(); ; )
|
|
156
106
|
try {
|
|
157
|
-
var
|
|
158
|
-
if (
|
|
159
|
-
break;
|
|
107
|
+
var r = -parseInt(t(324)) / 1 * (parseInt(t(316)) / 2) + -parseInt(t(329)) / 3 + -parseInt(t(319)) / 4 + -parseInt(t(320)) / 5 * (-parseInt(t(318)) / 6) + -parseInt(t(326)) / 7 + parseInt(t(315)) / 8 * (-parseInt(t(327)) / 9) + -parseInt(t(314)) / 10 * (-parseInt(t(323)) / 11);
|
|
108
|
+
if (r === n) break;
|
|
160
109
|
x.push(x.shift());
|
|
161
|
-
} catch (
|
|
110
|
+
} catch (p) {
|
|
162
111
|
x.push(x.shift());
|
|
163
112
|
}
|
|
164
|
-
})(
|
|
165
|
-
function
|
|
166
|
-
var
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
var a = k();
|
|
173
|
-
return D = function(x, o) {
|
|
174
|
-
x = x - 166;
|
|
175
|
-
var h = a[x];
|
|
176
|
-
return h;
|
|
177
|
-
}, D(n, e);
|
|
113
|
+
})(y, 490146);
|
|
114
|
+
function D(a, n) {
|
|
115
|
+
var t = y();
|
|
116
|
+
return D = function(x, r) {
|
|
117
|
+
x = x - 314;
|
|
118
|
+
var p = t[x];
|
|
119
|
+
return p;
|
|
120
|
+
}, D(a, n);
|
|
178
121
|
}
|
|
179
|
-
function
|
|
180
|
-
var
|
|
181
|
-
return { name:
|
|
182
|
-
var
|
|
183
|
-
Object[
|
|
184
|
-
} }], leastHiprintVersion:
|
|
122
|
+
function M(a) {
|
|
123
|
+
var n = D;
|
|
124
|
+
return { name: n(325), description: "add toPdf Api", hooks: [{ hook: n(317), name: n(322), description: n(322), priority: 1, run: ({ template: t, options: x }) => {
|
|
125
|
+
var r = n;
|
|
126
|
+
Object[r(330)](t, r(328), { value: W, enumerable: !1, writable: !0, configurable: !0 });
|
|
127
|
+
} }], leastHiprintVersion: n(321) };
|
|
185
128
|
}
|
|
186
129
|
export {
|
|
187
|
-
|
|
130
|
+
M as default
|
|
188
131
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
<div class="hiprint-printPaper" style="width:`,"log","8PTQNAi","hinnn","6KkqdMM","mm;height:","height","toPt","save","addImage","56fzgXvZ","then",".hiprint-printPaper","2421405iFSuvo","toDataURL","dpr","css","JPEG","paperHeight","\u81EA\u5B9A\u4E49","append","pixelRatio",`mm;"></div>
|
|
3
|
-
</div>`,"63397avRfSw","mm ","floor","8iPKQQR","row","clear","createTempContainer","run","image/jpeg",`mm;
|
|
4
|
-
}
|
|
5
|
-
</style>`,"mm -","blob","getTempContainer","type",`mm;
|
|
6
|
-
}
|
|
7
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
8
|
-
display:inline-block;
|
|
9
|
-
padding: `,"cur","onProgress"];return f=function(){return n},f()}function b(n,a){const t=f();return b=function(x,l){return x=x-259,t[x]},b(n,a)}const N=function(n,a,t){return Q(this,null,function*(){const x=b;var l=this,P=globalThis.$.Deferred(),K=!![];let q=(w,C)=>{const h=b,i=Math.floor(w/C*100);console.log(h(334),w,h(272),C),console[h(297)](h(292),i+"%")},e=t||{};if(this.printPanels[x(274)]){if(typeof a=="string"){const d=a[x(346)](x(294))>-1?a:a+x(294);e[x(283)]=d}else e=a||{},!e.name&&(e[x(283)]=x(277)+Date[x(338)]()+x(294));let w=this[x(343)][0].width,C=this[x(343)][0][x(302)];var z=globalThis[x(299)].mm[x(303)](e[x(285)]||w),O=globalThis.hinnn.mm[x(303)](e[x(314)]||C),_=globalThis.$.extend({},e||{});const h=this[x(343)][0][x(259)],i=this[x(343)][0][x(264)],E=i&&(i[x(290)]>0||i[x(281)]>0),H=h!=null&&h!=""&&h!=x(315);var j=new m.jsPDF({orientation:this[x(263)](0)==1?"portrait":"landscape",unit:"pt",format:H?h[x(291)]():[z,O]}),y=yield this[x(293)](n,e);e&&(e.pixelRatio&&(_[x(311)]=e[x(317)],_[x(336)]=e.pixelRatio),e[x(295)]!=null&&(K=e[x(295)]),e[x(335)]!=null&&(q=e[x(335)])),globalThis.$(y)[x(312)](x(276),"")[x(312)](x(302),""),this[x(325)]();var I=this[x(331)]();if(E&&e.paperWidth&&e.paperHeight){let d=Math.floor(e[x(285)]/(w+i.layoutRowGap/2)),u=Math[x(321)](e[x(314)]/(C+i[x(281)]/2));const M=d*u,o=y[x(342)](x(337)),R=o[x(274)],p=Math[x(339)](R/M);let s=globalThis.$('<div class="hiprint-printTemplate"></div>');i[x(282)]==x(323)?s.append(`<style>
|
|
10
|
-
.hiprint-printPanel-small{
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
border: 0px;
|
|
13
|
-
}
|
|
14
|
-
.hiprint-printPaper-small{
|
|
15
|
-
position: relative;
|
|
16
|
-
padding: 0;
|
|
17
|
-
}
|
|
18
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
19
|
-
margin: -`+(Number(i[x(290)])||0)/2+x(329)+(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(320)+(Number(i.layoutColumnGap)||0)/2+x(328)):s[x(316)](`<style>
|
|
24
|
-
.hiprint-printPanel-small{
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
border: 0px;
|
|
27
|
-
}
|
|
28
|
-
.hiprint-printPaper-small{
|
|
29
|
-
position: relative;
|
|
30
|
-
padding: 0;
|
|
31
|
-
}
|
|
32
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-wrap: wrap;
|
|
35
|
-
flex-direction: column;
|
|
36
|
-
align-content: flex-start;
|
|
37
|
-
margin: -`+(Number(i[x(290)])||0)/2+"mm -"+(Number(i[x(281)])||0)/2+x(333)+(Number(i[x(290)])||0)/2+x(320)+(Number(i[x(281)])||0)/2+x(328));for(let r=0;r<p;r++){const k=globalThis.$(x(296)+e[x(285)]+x(301)+e[x(314)]+x(318)),A=r*M,S=Math[x(279)]((r+1)*M,R);for(let D=A;D<S;D++){const $=o.eq(D).clone();$[x(266)](x(271)),$[x(286)](x(268)+D);const L=globalThis.$(x(289));L[x(316)]($),k[x(342)](x(308))[x(316)](L)}s[x(316)](k)}this[x(345)](s,_),I[x(341)](s[0]),globalThis.$(s)[x(312)](x(269))}else this.svg2canvas(y,_),I[x(341)](y[0]),globalThis.$(y).css(x(269));let G=I[x(342)](x(337))[x(274)];this.loadAllImages(I,function(){const d=x;try{I[d(342)](d(337))[d(267)](function(u,M){const o=d;globalThis[o(299)][o(275)][o(284)](function(R){const p=o;c.snapdom[p(270)](M,_)[p(307)](function(s){const r=p;var k=s[r(347)]("2d");k[r(262)]=![];var A=s[r(310)](r(327),_[r(265)]||.92);j[r(305)](A,r(313),0,0,z,O),u<G-1&&j.addPage(),q(u+1,G),R()}).catch(s=>{const r=p;throw new Error(s[r(278)])})}),u==G-1&&(globalThis[o(299)][o(275)][o(284)](function(R){const p=o;if(K)l.removeTempContainer(),j[p(304)](e.name);else{l.removeTempContainer();let s=e[p(332)]||p(330),r=j.output(s);P[p(260)](r)}globalThis[p(299)][p(275)][p(324)]()}),globalThis[o(299)][o(275)][o(326)]())})}catch(u){console[d(273)](d(348)),console[d(297)](u)}})}return P.promise()})};(function(n,a){for(var t=v,x=n();[];)try{var l=-parseInt(t(182))/1+parseInt(t(180))/2*(parseInt(t(177))/3)+-parseInt(t(168))/4*(-parseInt(t(175))/5)+-parseInt(t(178))/6+-parseInt(t(170))/7*(parseInt(t(169))/8)+-parseInt(t(167))/9+-parseInt(t(172))/10*(-parseInt(t(166))/11);if(l===a)break;x.push(x.shift())}catch(P){x.push(x.shift())}})(g,773925);function g(){var n=["7jWTMBh","defineProperty","10UxNSUv","toPdf","add toPdf Api to PrintTemplate","3468995hOTDPG","newPrintTemplate","135nlihLD","4820274JeKfwF","0.3.0","60578fPdzRk","add toPdf Api","85323GEkipK","9455402eKsIIR","8394813TXIBAD","8TjXBIM","8118408dNDtkM"];return g=function(){return n},g()}function v(n,a){var t=g();return v=function(x,l){x=x-166;var P=t[x];return P},v(n,a)}function T(n){var a=v;return{name:a(181),description:a(181),hooks:[{hook:a(176),name:a(174),description:"add toPdf Api to PrintTemplate",priority:1,run:({template:t,options:x})=>{var l=a;Object[l(171)](t,l(173),{value:N,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:a(179)}}return T});
|
|
1
|
+
(function(r,d){typeof exports=="object"&&typeof module!="undefined"?module.exports=d(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],d):(r=typeof globalThis!="undefined"?globalThis:r||self,r.pluginApiPdf=d(r.window,r.jspdf))})(this,function(r,d){"use strict";var G=(r,d,l)=>new Promise((u,c)=>{var h=n=>{try{_(l.next(n))}catch(t){c(t)}},b=n=>{try{_(l.throw(n))}catch(t){c(t)}},_=n=>n.done?u(n.value):Promise.resolve(n.value).then(h,b);_((l=l.apply(r,d)).next())});(function(n,t){const x=u,e=n();for(;;)try{if(-parseInt(x(364))/1*(-parseInt(x(353))/2)+-parseInt(x(341))/3*(parseInt(x(378))/4)+parseInt(x(347))/5+parseInt(x(351))/6*(parseInt(x(369))/7)+parseInt(x(371))/8+-parseInt(x(374))/9+-parseInt(x(352))/10*(parseInt(x(334))/11)===t)break;e.push(e.shift())}catch(i){e.push(e.shift())}})(c,319677);const l=function(n,t,x){return G(this,null,function*(){const e=u;var i=this,m=globalThis.$[e(340)](),C=!0;let k=(D,j)=>{const f=e,g=Math[f(361)](D/j*100);console[f(319)](f(377),D,"total",j),console[f(319)](f(372),g+"%")},a=x||{};if(this[e(382)][e(327)]){if(typeof t===e(375)){const o=t[e(367)](e(365))>-1?t:t+e(365);a[e(360)]=o}else a=t||{},!a[e(360)]&&(a.name=e(362)+Date[e(344)]()+e(365));let D=this[e(382)][0][e(333)],j=this[e(382)][0][e(348)];const f=a[e(343)]&&a[e(330)];var R=globalThis[e(363)].mm[e(323)](a[e(343)]||D),X=globalThis.hinnn.mm[e(323)](a[e(330)]||j),I=globalThis.$[e(338)]({backgroundColor:e(329)},a||{});const g=this[e(382)][0][e(335)],O=g!=null&&g!=""&&g!=e(376),Z=this[e(321)](0)==1||f?e(328):"landscape",z=O&&!f?g[e(332)]():[R,X];var w=new d.jsPDF({orientation:Z,unit:"pt",format:z}),q=yield this.getHtml(n,a);a&&(a[e(326)]&&(I[e(346)]=a.pixelRatio,I[e(368)]=a[e(326)]),a[e(379)]!=null&&(C=a[e(379)]),a[e(336)]!=null&&(k=a[e(336)])),globalThis.$(q)[e(355)]("width","")[e(355)](e(348),""),this[e(325)]();var y=this[e(342)]();this[e(331)](q,I),y[e(337)](q[0]),globalThis.$(q)[e(355)](e(324));let A=y[e(354)](e(381)).length;this[e(370)](y,function(){const o=e;try{y[o(354)](o(381))[o(345)](function(T,B){const s=o;globalThis[s(363)][s(322)][s(358)](function(E){const p=s;r.snapdom.toCanvas(B,I)[p(318)](function(v){const P=p;var H=v[P(366)]("2d");H[P(356)]=!1;var W=v.toDataURL("image/jpeg",I.quality||.92);w.addImage(W,P(320),0,0,R,X),T<A-1&&w.addPage(),k(T+1,A),E()})[p(350)](v=>{throw new Error(v.message)})}),T==A-1&&(globalThis.hinnn.queue[s(358)](function(E){const p=s;if(C)i.removeTempContainer(),w[p(349)](a[p(360)]);else{i[p(359)]();let v=a[p(373)]||"blob",P=w.output(v);m.resolve(P)}globalThis[p(363)].queue.clear()}),globalThis[s(363)][s(322)][s(380)]())})}catch(T){console[o(339)](o(357)),console[o(319)](T)}})}return m.promise()})};function u(n,t){const x=c();return u=function(e,i){return e=e-318,x[e]},u(n,t)}function c(){const n=["save","catch","1270116jXYvDl","10isvtQq","134FXOcys","find","css","imageSmoothingEnabled","toPdf 失败(可能您的图片资源无法正常加载): ","add","removeTempContainer","name","floor","sv-print-","hinnn","2913lJqTSb",".pdf","getContext","indexOf","scale","7ephwfs","loadAllImages","2436640DEXpzD","toPdf percent: ","type","4154787eMEquO","string","自定义","cur","11468BswBuP","isDownload","run",".hiprint-printPanel .hiprint-printPaper","printPanels","then","log","JPEG","getOrient","queue","toPt","position:fixed","createTempContainer","pixelRatio","length","portrait","#fff","paperHeight","svg2canvas","toLocaleLowerCase","width","565334qhgZZz","paperType","onProgress","html","extend","error","Deferred","183uXkDZV","getTempContainer","paperWidth","now","each","dpr","1480820qWimoZ","height"];return c=function(){return n},c()}function h(){var n=["2979GBpDqr","add toPdf Api","4575935rhWZqJ","918DcynHl","toPdf","1523658KGpjTG","defineProperty","1531140yqUKYr","46392ARDXSt","230qAbAyB","newPrintTemplate","5242002lfWGRM","2950684ipXaaP","5TaYwDD","0.3.0","add toPdf Api to PrintTemplate","176VhqARN"];return h=function(){return n},h()}(function(n,t){for(var x=b,e=n();;)try{var i=-parseInt(x(324))/1*(parseInt(x(316))/2)+-parseInt(x(329))/3+-parseInt(x(319))/4+-parseInt(x(320))/5*(-parseInt(x(318))/6)+-parseInt(x(326))/7+parseInt(x(315))/8*(-parseInt(x(327))/9)+-parseInt(x(314))/10*(-parseInt(x(323))/11);if(i===t)break;e.push(e.shift())}catch(m){e.push(e.shift())}})(h,490146);function b(n,t){var x=h();return b=function(e,i){e=e-314;var m=x[e];return m},b(n,t)}function _(n){var t=b;return{name:t(325),description:"add toPdf Api",hooks:[{hook:t(317),name:t(322),description:t(322),priority:1,run:({template:x,options:e})=>{var i=t;Object[i(330)](x,i(328),{value:l,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:t(321)}}return _});
|