@sv-print/plugin-api-pdf 0.1.2 → 0.2.0
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 +16 -10
- package/dist/index.mjs +122 -119
- package/dist/index.umd.js +16 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var L=(n,e,a)=>new Promise((x,p)=>{var l=t=>{try{f(a.next(t))}catch(m){p(m)}},I=t=>{try{f(a.throw(t))}catch(m){p(m)}},f=t=>t.done?x(t.value):Promise.resolve(t.value).then(l,I);f((a=a.apply(n,e)).next())});const J=require("@zumer/snapdom"),Q=require("jspdf");(function(n,e){const a=b,x=n();for(;[];)try{if(parseInt(a(150))/1+parseInt(a(169))/2*(parseInt(a(168))/3)+-parseInt(a(174))/4*(parseInt(a(137))/5)+-parseInt(a(139))/6+parseInt(a(140))/7*(-parseInt(a(172))/8)+parseInt(a(151))/9*(-parseInt(a(178))/10)+parseInt(a(165))/11*(parseInt(a(159))/12)===e)break;x.push(x.shift())}catch(p){x.push(x.shift())}})(M,286433);function b(n,e){const a=M();return b=function(x,p){return x=x-122,a[x]},b(n,e)}const U=function(n,e,a){return L(this,null,function*(){const x=b;var p=this,l=globalThis.$.Deferred(),I=!![];let f=(v,P)=>{const c=b,i=Math.floor(v/P*100);console[c(122)](c(124),v,"total",P),console[c(122)]("toPdf percent: ",i+"%")},t=a||{};if(this[x(191)][x(170)]){if(typeof e=="string"){const d=e[x(180)](x(160))>-1?e:e+x(160);t[x(131)]=d}else t=e||{},!t[x(131)]&&(t[x(131)]=x(194)+Date[x(195)]()+x(160));let v=this.printPanels[0][x(183)],P=this.printPanels[0][x(167)];var m=globalThis[x(152)].mm[x(193)](t[x(198)]||v),k=globalThis[x(152)].mm[x(193)](t[x(147)]||P),u=globalThis.$[x(161)]({},t||{});const c=this.printPanels[0].paperType,i=this[x(191)][0][x(199)],O=i&&(i.layoutRowGap>0||i[x(197)]>0),R=c!=null&&c!=""&&c!=x(202);var w=new Q.jsPDF({orientation:this[x(142)](0)==1?x(126):"landscape",unit:"pt",format:R?c[x(158)]():[m,k]}),g=yield this.getHtml(n,t);t&&(t[x(176)]&&(u[x(134)]=t[x(176)],u[x(133)]=t[x(176)]),t[x(181)]!=null&&(I=t[x(181)]),t[x(179)]!=null&&(f=t[x(179)])),globalThis.$(g)[x(148)](x(183),"").css(x(167),""),this[x(175)]();var C=this[x(156)]();if(O&&t.paperWidth&&t.paperHeight){let d=Math[x(130)](t[x(198)]/(v+i[x(141)]/2)),h=Math[x(130)](t[x(147)]/(P+i[x(197)]/2));const _=d*h,T=g.find(x(189)),y=T[x(170)],r=Math[x(157)](y/_);let o=globalThis.$(x(144));i.layoutType==x(171)?o.append(x(127)+(Number(i[x(141)])||0)/2+x(184)+(Number(i[x(197)])||0)/2+`mm;
|
|
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>
|
|
2
6
|
.hiprint-printPanel-small{
|
|
3
7
|
box-sizing: border-box;
|
|
4
8
|
border: 0px;
|
|
@@ -12,11 +16,16 @@
|
|
|
12
16
|
flex-wrap: wrap;
|
|
13
17
|
flex-direction: column;
|
|
14
18
|
align-content: flex-start;
|
|
15
|
-
margin: -`+(Number(
|
|
16
|
-
|
|
17
|
-
|
|
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;
|
|
18
26
|
}
|
|
19
|
-
</style>`,"
|
|
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>
|
|
20
29
|
.hiprint-printPanel-small{
|
|
21
30
|
box-sizing: border-box;
|
|
22
31
|
border: 0px;
|
|
@@ -26,8 +35,5 @@
|
|
|
26
35
|
padding: 0;
|
|
27
36
|
}
|
|
28
37
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
29
|
-
margin: -`,"
|
|
30
|
-
|
|
31
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
32
|
-
display:inline-block;
|
|
33
|
-
padding: `,"pop","tagName","find","queue","mm ","layoutType","getHtml","403090NSIRHY","type","position:fixed",".hiprint-printPaper","floor","2334186Csqjzd","http","append","jpeg","toPt","output","toPdf percent: ",".pdf","log","toCanvas","landscape"];return O=function(){return n},O()}(function(n,i){for(var e=q,x=n();[];)try{var p=parseInt(e(186))/1*(parseInt(e(181))/2)+parseInt(e(177))/3+parseInt(e(180))/4*(-parseInt(e(184))/5)+-parseInt(e(183))/6*(parseInt(e(187))/7)+-parseInt(e(176))/8*(-parseInt(e(174))/9)+-parseInt(e(182))/10+parseInt(e(179))/11;if(p===i)break;x.push(x.shift())}catch(b){x.push(x.shift())}})(M,137645);function q(n,i){var e=M();return q=function(x,p){x=x-172;var b=e[x];return b},q(n,i)}function M(){var n=["30969oTwVoo","add toPdf Api","8wHhBkC","559548rBzwwo","toPdf","3110712lnIVuv","4DFfgVw","82OKQCWw","89540jzfgLR","512610MGUCRx","1023220TKZNhr","defineProperty","1204Tvmeyj","14qGSnNa","newPrintTemplate","add toPdf Api to PrintTemplate","0.3.0"];return M=function(){return n},M()}function E(n){var i=q;return{name:"add toPdf Api",description:i(175),hooks:[{hook:i(188),name:"add toPdf Api to PrintTemplate",description:i(172),priority:1,run:({template:e,options:x})=>{var p=i;Object[p(185)](e,p(178),{value:B,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:i(173)}}module.exports=E;
|
|
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;
|
package/dist/index.mjs
CHANGED
|
@@ -1,66 +1,67 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var O = (e, n, a) => new Promise((x, p) => {
|
|
2
|
+
var l = (t) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
4
|
+
f(a.next(t));
|
|
5
5
|
} catch (m) {
|
|
6
6
|
p(m);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, I = (t) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
f(a.throw(t));
|
|
11
11
|
} catch (m) {
|
|
12
12
|
p(m);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, f = (t) => t.done ? x(t.value) : Promise.resolve(t.value).then(l, I);
|
|
15
|
+
f((a = a.apply(e, n)).next());
|
|
16
16
|
});
|
|
17
|
-
import
|
|
18
|
-
import { jsPDF as
|
|
19
|
-
(function(
|
|
20
|
-
const
|
|
17
|
+
import { snapdom as J } from "@zumer/snapdom";
|
|
18
|
+
import { jsPDF as Q } from "jspdf";
|
|
19
|
+
(function(e, n) {
|
|
20
|
+
const a = b, x = e();
|
|
21
21
|
for (; []; )
|
|
22
22
|
try {
|
|
23
|
-
if (parseInt(
|
|
23
|
+
if (parseInt(a(150)) / 1 + parseInt(a(169)) / 2 * (parseInt(a(168)) / 3) + -parseInt(a(174)) / 4 * (parseInt(a(137)) / 5) + -parseInt(a(139)) / 6 + parseInt(a(140)) / 7 * (-parseInt(a(172)) / 8) + parseInt(a(151)) / 9 * (-parseInt(a(178)) / 10) + parseInt(a(165)) / 11 * (parseInt(a(159)) / 12) === n)
|
|
24
24
|
break;
|
|
25
25
|
x.push(x.shift());
|
|
26
26
|
} catch (p) {
|
|
27
27
|
x.push(x.shift());
|
|
28
28
|
}
|
|
29
|
-
})(
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
-
return x = x -
|
|
34
|
-
},
|
|
29
|
+
})(N, 286433);
|
|
30
|
+
function b(e, n) {
|
|
31
|
+
const a = N();
|
|
32
|
+
return b = function(x, p) {
|
|
33
|
+
return x = x - 122, a[x];
|
|
34
|
+
}, b(e, n);
|
|
35
35
|
}
|
|
36
|
-
const U = function(
|
|
37
|
-
return
|
|
38
|
-
const x =
|
|
39
|
-
var p = this,
|
|
40
|
-
let
|
|
41
|
-
const
|
|
42
|
-
console[
|
|
43
|
-
}, t =
|
|
44
|
-
if (this[x(
|
|
36
|
+
const U = function(e, n, a) {
|
|
37
|
+
return O(this, null, function* () {
|
|
38
|
+
const x = b;
|
|
39
|
+
var p = this, l = globalThis.$.Deferred(), I = !![];
|
|
40
|
+
let f = (v, P) => {
|
|
41
|
+
const c = b, i = Math.floor(v / P * 100);
|
|
42
|
+
console[c(122)](c(124), v, "total", P), console[c(122)]("toPdf percent: ", i + "%");
|
|
43
|
+
}, t = a || {};
|
|
44
|
+
if (this[x(191)][x(170)]) {
|
|
45
45
|
if (typeof n == "string") {
|
|
46
|
-
const
|
|
47
|
-
t[x(
|
|
46
|
+
const d = n[x(180)](x(160)) > -1 ? n : n + x(160);
|
|
47
|
+
t[x(131)] = d;
|
|
48
48
|
} else
|
|
49
|
-
t = n || {}, !t[x(
|
|
50
|
-
let
|
|
51
|
-
var m = globalThis[x(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
t = n || {}, !t[x(131)] && (t[x(131)] = x(194) + Date[x(195)]() + x(160));
|
|
50
|
+
let v = this.printPanels[0][x(183)], P = this.printPanels[0][x(167)];
|
|
51
|
+
var m = globalThis[x(152)].mm[x(193)](t[x(198)] || v), k = globalThis[x(152)].mm[x(193)](t[x(147)] || P), u = globalThis.$[x(161)]({}, t || {});
|
|
52
|
+
const c = this.printPanels[0].paperType, i = this[x(191)][0][x(199)], R = i && (i.layoutRowGap > 0 || i[x(197)] > 0), z = c != null && c != "" && c != x(202);
|
|
53
|
+
var w = new Q({ orientation: this[x(142)](0) == 1 ? x(126) : "landscape", unit: "pt", format: z ? c[x(158)]() : [m, k] }), g = yield this.getHtml(e, t);
|
|
54
|
+
t && (t[x(176)] && (u[x(134)] = t[x(176)], u[x(133)] = t[x(176)]), t[x(181)] != null && (I = t[x(181)]), t[x(179)] != null && (f = t[x(179)])), globalThis.$(g)[x(148)](x(183), "").css(x(167), ""), this[x(175)]();
|
|
55
|
+
var C = this[x(156)]();
|
|
56
|
+
if (R && t.paperWidth && t.paperHeight) {
|
|
57
|
+
let d = Math[x(130)](t[x(198)] / (v + i[x(141)] / 2)), h = Math[x(130)](t[x(147)] / (P + i[x(197)] / 2));
|
|
58
|
+
const _ = d * h, T = g.find(x(189)), y = T[x(170)], r = Math[x(157)](y / _);
|
|
59
|
+
let s = globalThis.$(x(144));
|
|
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>
|
|
64
65
|
.hiprint-printPanel-small{
|
|
65
66
|
box-sizing: border-box;
|
|
66
67
|
border: 0px;
|
|
@@ -74,64 +75,69 @@ const U = function(o, n, e) {
|
|
|
74
75
|
flex-wrap: wrap;
|
|
75
76
|
flex-direction: column;
|
|
76
77
|
align-content: flex-start;
|
|
77
|
-
margin: -` + (Number(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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);
|
|
87
92
|
}
|
|
88
|
-
|
|
93
|
+
s[x(129)](G);
|
|
89
94
|
}
|
|
90
|
-
this
|
|
95
|
+
this.svg2canvas(s, u), C[x(200)](s[0]), globalThis.$(s).css(x(164));
|
|
91
96
|
} else
|
|
92
|
-
this[x(
|
|
93
|
-
let
|
|
94
|
-
this.loadAllImages(
|
|
95
|
-
const
|
|
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;
|
|
96
101
|
try {
|
|
97
|
-
C[
|
|
98
|
-
const
|
|
99
|
-
globalThis
|
|
100
|
-
const r =
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
})[r(
|
|
108
|
-
const
|
|
109
|
-
throw new Error(
|
|
102
|
+
C[d(149)](".hiprint-printPanel .hiprint-printPaper").each(function(h, _) {
|
|
103
|
+
const T = d;
|
|
104
|
+
globalThis.hinnn.queue.add(function(y) {
|
|
105
|
+
const r = b;
|
|
106
|
+
J[r(135)](_, u).then(function(s) {
|
|
107
|
+
const o = r;
|
|
108
|
+
var G = s[o(153)]("2d");
|
|
109
|
+
G.imageSmoothingEnabled = ![];
|
|
110
|
+
var D = s[o(162)](o(146), u[o(196)] || 0.92);
|
|
111
|
+
w.addImage(D, "JPEG", 0, 0, m, k), h < $ - 1 && w[o(177)](), f(h + 1, $), y();
|
|
112
|
+
})[r(125)]((s) => {
|
|
113
|
+
const o = r;
|
|
114
|
+
throw new Error(s[o(190)]);
|
|
110
115
|
});
|
|
111
|
-
}),
|
|
112
|
-
const r =
|
|
113
|
-
if (
|
|
114
|
-
p[r(
|
|
116
|
+
}), h == $ - 1 && (globalThis.hinnn.queue.add(function(y) {
|
|
117
|
+
const r = b;
|
|
118
|
+
if (I)
|
|
119
|
+
p[r(155)](), w[r(166)](t.name);
|
|
115
120
|
else {
|
|
116
|
-
p[r(
|
|
117
|
-
let
|
|
118
|
-
|
|
121
|
+
p[r(155)]();
|
|
122
|
+
let s = t[r(128)] || "blob", o = w[r(182)](s);
|
|
123
|
+
l.resolve(o);
|
|
119
124
|
}
|
|
120
|
-
globalThis[r(
|
|
121
|
-
}), globalThis[
|
|
125
|
+
globalThis[r(152)][r(201)][r(188)]();
|
|
126
|
+
}), globalThis[T(152)][T(201)].run());
|
|
122
127
|
});
|
|
123
|
-
} catch (
|
|
124
|
-
console
|
|
128
|
+
} catch (h) {
|
|
129
|
+
console.error(d(154)), console[d(122)](h);
|
|
125
130
|
}
|
|
126
131
|
});
|
|
127
132
|
}
|
|
128
|
-
return
|
|
133
|
+
return l[x(187)]();
|
|
129
134
|
});
|
|
130
135
|
};
|
|
131
|
-
function
|
|
132
|
-
const
|
|
136
|
+
function N() {
|
|
137
|
+
const e = ["mm -", `mm;
|
|
133
138
|
}
|
|
134
|
-
</style>`, "
|
|
139
|
+
</style>`, "hiprint-printPaper", "promise", "clear", ".hiprint-printPanel .hiprint-printPaper", "message", "printPanels", `mm;"></div>
|
|
140
|
+
</div>`, "toPt", "sv-print-", "now", "quality", "layoutColumnGap", "paperWidth", "panelLayoutOptions", "html", "queue", "\u81EA\u5B9A\u4E49", "log", "svg2canvas", "cur", "catch", "portrait", `<style>
|
|
135
141
|
.hiprint-printPanel-small{
|
|
136
142
|
box-sizing: border-box;
|
|
137
143
|
border: 0px;
|
|
@@ -141,47 +147,44 @@ function G() {
|
|
|
141
147
|
padding: 0;
|
|
142
148
|
}
|
|
143
149
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
144
|
-
margin: -`, "
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return G = function() {
|
|
150
|
-
return o;
|
|
151
|
-
}, G();
|
|
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();
|
|
152
155
|
}
|
|
153
|
-
(function(
|
|
154
|
-
for (var
|
|
156
|
+
(function(e, n) {
|
|
157
|
+
for (var a = q, x = e(); []; )
|
|
155
158
|
try {
|
|
156
|
-
var p = parseInt(
|
|
159
|
+
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;
|
|
157
160
|
if (p === n)
|
|
158
161
|
break;
|
|
159
162
|
x.push(x.shift());
|
|
160
|
-
} catch (
|
|
163
|
+
} catch (l) {
|
|
161
164
|
x.push(x.shift());
|
|
162
165
|
}
|
|
163
|
-
})(
|
|
164
|
-
function
|
|
165
|
-
var e =
|
|
166
|
-
return
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return b;
|
|
170
|
-
}, L(o, n);
|
|
166
|
+
})(W, 481406);
|
|
167
|
+
function W() {
|
|
168
|
+
var e = ["27MOEhSM", "2658680YUaTMa", "5557548stYncn", "16497676NlNbli", "11923zUbcJC", "37975mfUsZp", "11xDpdlH", "toPdf", "add toPdf Api to PrintTemplate", "173243Bcupwv", "64wscRfe", "newPrintTemplate", "defineProperty", "add toPdf Api", "1557396BomoGG", "104eqxYYo", "3QWpgdj", "606hmxlWr"];
|
|
169
|
+
return W = function() {
|
|
170
|
+
return e;
|
|
171
|
+
}, W();
|
|
171
172
|
}
|
|
172
|
-
function
|
|
173
|
-
var
|
|
174
|
-
return
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
function q(e, n) {
|
|
174
|
+
var a = W();
|
|
175
|
+
return q = function(x, p) {
|
|
176
|
+
x = x - 368;
|
|
177
|
+
var l = a[x];
|
|
178
|
+
return l;
|
|
179
|
+
}, q(e, n);
|
|
177
180
|
}
|
|
178
|
-
function
|
|
179
|
-
var n =
|
|
180
|
-
return { name:
|
|
181
|
+
function Y(e) {
|
|
182
|
+
var n = q;
|
|
183
|
+
return { name: n(381), description: n(381), hooks: [{ hook: n(379), name: "add toPdf Api to PrintTemplate", description: n(376), priority: 1, run: ({ template: a, options: x }) => {
|
|
181
184
|
var p = n;
|
|
182
|
-
Object[p(
|
|
183
|
-
} }], leastHiprintVersion:
|
|
185
|
+
Object[p(380)](a, p(375), { value: U, enumerable: ![], writable: !![], configurable: !![] });
|
|
186
|
+
} }], leastHiprintVersion: "0.3.0" };
|
|
184
187
|
}
|
|
185
188
|
export {
|
|
186
|
-
|
|
189
|
+
Y as default
|
|
187
190
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(d,f){typeof exports=="object"&&typeof module!="undefined"?module.exports=f(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],f):(d=typeof globalThis!="undefined"?globalThis:d||self,d.pluginApiPdf=f(d.snapdom,d.jspdf))})(this,function(d,f){"use strict";var H=(d,f,o)=>new Promise((W,b)=>{var u=n=>{try{T(o.next(n))}catch(e){b(e)}},g=n=>{try{T(o.throw(n))}catch(e){b(e)}},T=n=>n.done?W(n.value):Promise.resolve(n.value).then(u,g);T((o=o.apply(d,f)).next())});(function(n,e){const t=o,x=n();for(;[];)try{if(parseInt(t(150))/1+parseInt(t(169))/2*(parseInt(t(168))/3)+-parseInt(t(174))/4*(parseInt(t(137))/5)+-parseInt(t(139))/6+parseInt(t(140))/7*(-parseInt(t(172))/8)+parseInt(t(151))/9*(-parseInt(t(178))/10)+parseInt(t(165))/11*(parseInt(t(159))/12)===e)break;x.push(x.shift())}catch(l){x.push(x.shift())}})(b,286433);function o(n,e){const t=b();return o=function(x,l){return x=x-122,t[x]},o(n,e)}const W=function(n,e,t){return H(this,null,function*(){const x=o;var l=this,P=globalThis.$.Deferred(),k=!![];let L=(y,I)=>{const c=o,i=Math.floor(y/I*100);console[c(122)](c(124),y,"total",I),console[c(122)]("toPdf percent: ",i+"%")},a=t||{};if(this[x(191)][x(170)]){if(typeof e=="string"){const h=e[x(180)](x(160))>-1?e:e+x(160);a[x(131)]=h}else a=e||{},!a[x(131)]&&(a[x(131)]=x(194)+Date[x(195)]()+x(160));let y=this.printPanels[0][x(183)],I=this.printPanels[0][x(167)];var O=globalThis[x(152)].mm[x(193)](a[x(198)]||y),R=globalThis[x(152)].mm[x(193)](a[x(147)]||I),v=globalThis.$[x(161)]({},a||{});const c=this.printPanels[0].paperType,i=this[x(191)][0][x(199)],J=i&&(i.layoutRowGap>0||i[x(197)]>0),Q=c!=null&&c!=""&&c!=x(202);var q=new f.jsPDF({orientation:this[x(142)](0)==1?x(126):"landscape",unit:"pt",format:Q?c[x(158)]():[O,R]}),_=yield this.getHtml(n,a);a&&(a[x(176)]&&(v[x(134)]=a[x(176)],v[x(133)]=a[x(176)]),a[x(181)]!=null&&(k=a[x(181)]),a[x(179)]!=null&&(L=a[x(179)])),globalThis.$(_)[x(148)](x(183),"").css(x(167),""),this[x(175)]();var G=this[x(156)]();if(J&&a.paperWidth&&a.paperHeight){let h=Math[x(130)](a[x(198)]/(y+i[x(141)]/2)),m=Math[x(130)](a[x(147)]/(I+i[x(197)]/2));const w=h*m,C=_.find(x(189)),j=C[x(170)],r=Math[x(157)](j/w);let s=globalThis.$(x(144));i.layoutType==x(171)?s.append(x(127)+(Number(i[x(141)])||0)/2+x(184)+(Number(i[x(197)])||0)/2+`mm;
|
|
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>
|
|
2
6
|
.hiprint-printPanel-small{
|
|
3
7
|
box-sizing: border-box;
|
|
4
8
|
border: 0px;
|
|
@@ -12,11 +16,16 @@
|
|
|
12
16
|
flex-wrap: wrap;
|
|
13
17
|
flex-direction: column;
|
|
14
18
|
align-content: flex-start;
|
|
15
|
-
margin: -`+(Number(
|
|
16
|
-
|
|
17
|
-
|
|
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;
|
|
18
26
|
}
|
|
19
|
-
</style>`,"
|
|
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>
|
|
20
29
|
.hiprint-printPanel-small{
|
|
21
30
|
box-sizing: border-box;
|
|
22
31
|
border: 0px;
|
|
@@ -26,8 +35,5 @@
|
|
|
26
35
|
padding: 0;
|
|
27
36
|
}
|
|
28
37
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
29
|
-
margin: -`,"
|
|
30
|
-
|
|
31
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
32
|
-
display:inline-block;
|
|
33
|
-
padding: `,"pop","tagName","find","queue","mm ","layoutType","getHtml","403090NSIRHY","type","position:fixed",".hiprint-printPaper","floor","2334186Csqjzd","http","append","jpeg","toPt","output","toPdf percent: ",".pdf","log","toCanvas","landscape"];return v=function(){return a},v()}(function(a,n){for(var e=m,x=a();[];)try{var f=parseInt(e(186))/1*(parseInt(e(181))/2)+parseInt(e(177))/3+parseInt(e(180))/4*(-parseInt(e(184))/5)+-parseInt(e(183))/6*(parseInt(e(187))/7)+-parseInt(e(176))/8*(-parseInt(e(174))/9)+-parseInt(e(182))/10+parseInt(e(179))/11;if(f===n)break;x.push(x.shift())}catch(_){x.push(x.shift())}})(d,137645);function m(a,n){var e=d();return m=function(x,f){x=x-172;var _=e[x];return _},m(a,n)}function d(){var a=["30969oTwVoo","add toPdf Api","8wHhBkC","559548rBzwwo","toPdf","3110712lnIVuv","4DFfgVw","82OKQCWw","89540jzfgLR","512610MGUCRx","1023220TKZNhr","defineProperty","1204Tvmeyj","14qGSnNa","newPrintTemplate","add toPdf Api to PrintTemplate","0.3.0"];return d=function(){return a},d()}function y(a){var n=m;return{name:"add toPdf Api",description:n(175),hooks:[{hook:n(188),name:"add toPdf Api to PrintTemplate",description:n(172),priority:1,run:({template:e,options:x})=>{var f=n;Object[f(185)](e,f(178),{value:k,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:n(173)}}return y});
|
|
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});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sv-print/plugin-api-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "add pdf api to print template",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"sv-print": "^0.2.0",
|
|
36
36
|
"jspdf": "^2.5.2",
|
|
37
|
-
"
|
|
37
|
+
"@zumer/snapdom": "^2.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"vite-plugin-javascript-obfuscator": "^3.1.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"sv-print": "^0.2.0",
|
|
44
|
-
"
|
|
44
|
+
"@zumer/snapdom": "^2.0.1"
|
|
45
45
|
}
|
|
46
46
|
}
|