@sv-print/plugin-api-pdf3 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -37
- package/dist/index.mjs +106 -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 O=(a,n,x)=>new Promise((e,r)=>{var i=t=>{try{f(x.next(t))}catch(d){r(d)}},m=t=>{try{f(x.throw(t))}catch(d){r(d)}},f=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,m);f((x=x.apply(a,n)).next())});const N=require("@zumer/snapdom"),X=require("jspdf");(function(a,n){const x=_,e=a();for(;;)try{if(-parseInt(x(235))/1*(-parseInt(x(204))/2)+parseInt(x(265))/3*(parseInt(x(263))/4)+-parseInt(x(261))/5+-parseInt(x(255))/6+parseInt(x(226))/7+-parseInt(x(236))/8+parseInt(x(253))/9===n)break;e.push(e.shift())}catch(r){e.push(e.shift())}})(q,805112);function q(){const a=["11019785djLDsd","scale","quality","position:fixed","paperWidth","sv-print-","run","toPt","html","254XFVcJv","12482824Zgxxwp","loadAllImages","pixelRatio","#fff","getTempContainer","find","save","promise","css","log","message","resolve","getHtml","error","dpr","catch","now","5661324okfktP","length","2871960IqdRwT","portrait","toPdf 失败(可能您的图片资源无法正常加载): ","createTempContainer","then","removeTempContainer","863130tpXBwe","toCanvas","6824JfAINS","paperHeight","417VbAEiW","getContext","getOrient","svg2canvas","floor","toLocaleLowerCase","4538hqpOpY","toPdf percent: ","width","image/jpeg",".hiprint-printPanel .hiprint-printPaper","clear","queue","output","isDownload","hinnn","height","paperType","onProgress","Deferred","addPage","blob","name","printPanels","getLayoutSize","JPEG",".pdf","each"];return q=function(){return a},q()}const Q=function(a,n,x){return O(this,null,function*(){const e=_;var r=this,i=globalThis.$[e(217)](),m=!0;let f=(p,T)=>{const l=e,w=Math[l(202)](p/T*100);console[l(245)]("cur",p,"total",T),console[l(245)](l(205),w+"%")},t=x||{};if(this[e(221)][e(254)]){if(typeof n=="string"){const c=n.indexOf(".pdf")>-1?n:n+e(224);t.name=c}else t=n||{},!t[e(220)]&&(t.name=e(231)+Date[e(252)]()+e(224));const p=this.printPanels[0];let T=p[e(206)],l=p[e(214)];const w=p[e(222)](),j=t[e(230)]||w[e(230)],F=t[e(264)]||w[e(264)],J=j&&F;var d=globalThis[e(213)].mm[e(233)](j||T),D=globalThis[e(213)].mm[e(233)](F||l),u=globalThis.$.extend({backgroundColor:e(239)},t||{});const y=this[e(221)][0][e(215)],R=y!=null&&y!=""&&y!="自定义",S=this[e(200)](0)==1||J?e(256):"landscape",V=R&&!J?y[e(203)]():[d,D];var v=new X.jsPDF({orientation:S,unit:"pt",format:V}),I=yield this[e(248)](a,t);t&&(t[e(238)]&&(u[e(250)]=t[e(238)],u[e(227)]=t[e(238)]),t[e(212)]!=null&&(m=t[e(212)]),t.onProgress!=null&&(f=t[e(216)])),globalThis.$(I).css(e(206),"")[e(244)](e(214),""),this[e(258)]();var P=this[e(240)]();this[e(201)](I,u),P[e(234)](I[0]),globalThis.$(I)[e(244)](e(229));let A=P[e(241)](e(208)).length;this[e(237)](P,function(){const c=e;try{P.find(c(208))[c(225)](function(g,E){const b=c;globalThis.hinnn.queue.add(function(L){const o=_;N.snapdom[o(262)](E,u)[o(259)](function(h){const s=o;var H=h[s(266)]("2d");H.imageSmoothingEnabled=!1;var $=h.toDataURL(s(207),u[s(228)]||.92);v.addImage($,s(223),0,0,d,D),g<A-1&&v[s(218)](),f(g+1,A),L()})[o(251)](h=>{const s=o;throw new Error(h[s(246)])})}),g==A-1&&(globalThis[b(213)].queue.add(function(L){const o=b;if(m)r[o(260)](),v[o(242)](t[o(220)]);else{r[o(260)]();let h=t.type||o(219),s=v[o(211)](h);i[o(247)](s)}globalThis[o(213)].queue[o(209)]()}),globalThis[b(213)][b(210)][b(232)]())})}catch(g){console[c(249)](c(257)),console.log(g)}})}return i[e(243)]()})};function _(a,n){const x=q();return _=function(e,r){return e=e-200,x[e]},_(a,n)}function C(a,n){var x=k();return C=function(e,r){e=e-396;var i=x[e];return i},C(a,n)}(function(a,n){for(var x=C,e=a();;)try{var r=parseInt(x(396))/1+parseInt(x(398))/2+parseInt(x(400))/3+parseInt(x(397))/4*(-parseInt(x(406))/5)+parseInt(x(399))/6+-parseInt(x(401))/7*(-parseInt(x(403))/8)+-parseInt(x(407))/9;if(r===n)break;e.push(e.shift())}catch(i){e.push(e.shift())}})(k,395772);function k(){var a=["toPdf","add toPdf Api","40lbJPcP","6646320yNvcgn","newPrintTemplate","add toPdf Api to PrintTemplate","624876PapRUt","176744DHsbRP","666630qCbCOF","2254572VtSQtV","44274FIhXFl","2681ANrpQJ","0.3.0","2904IqSAna"];return k=function(){return a},k()}function U(a){var n=C;return{name:n(405),description:n(405),hooks:[{hook:n(408),name:n(409),description:n(409),priority:1,run:({template:x,options:e})=>{var r=n;Object.defineProperty(x,r(404),{value:Q,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(402)}}module.exports=U;
|
package/dist/index.mjs
CHANGED
|
@@ -1,188 +1,133 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var R = (a, n, x) => new Promise((e, r) => {
|
|
2
|
+
var s = (t) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
4
|
+
f(x.next(t));
|
|
5
|
+
} catch (d) {
|
|
6
|
+
r(d);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, _ = (t) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
10
|
+
f(x.throw(t));
|
|
11
|
+
} catch (d) {
|
|
12
|
+
r(d);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, f = (t) => t.done ? e(t.value) : Promise.resolve(t.value).then(s, _);
|
|
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 N } from "@zumer/snapdom";
|
|
18
|
+
import { jsPDF as X } from "jspdf";
|
|
19
|
+
(function(a, n) {
|
|
20
|
+
const x = b, e = a();
|
|
21
|
+
for (; ; )
|
|
22
22
|
try {
|
|
23
|
-
if (-parseInt(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
x.push(x.shift());
|
|
23
|
+
if (-parseInt(x(235)) / 1 * (-parseInt(x(204)) / 2) + parseInt(x(265)) / 3 * (parseInt(x(263)) / 4) + -parseInt(x(261)) / 5 + -parseInt(x(255)) / 6 + parseInt(x(226)) / 7 + -parseInt(x(236)) / 8 + parseInt(x(253)) / 9 === n) break;
|
|
24
|
+
e.push(e.shift());
|
|
25
|
+
} catch (r) {
|
|
26
|
+
e.push(e.shift());
|
|
28
27
|
}
|
|
29
|
-
})(
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</style>`, "mm -", "blob", "getTempContainer", "type", `mm;
|
|
36
|
-
}
|
|
37
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
38
|
-
display:inline-block;
|
|
39
|
-
padding: `, "cur", "onProgress"];
|
|
40
|
-
return N = function() {
|
|
41
|
-
return n;
|
|
42
|
-
}, N();
|
|
28
|
+
})(q, 805112);
|
|
29
|
+
function q() {
|
|
30
|
+
const a = ["11019785djLDsd", "scale", "quality", "position:fixed", "paperWidth", "sv-print-", "run", "toPt", "html", "254XFVcJv", "12482824Zgxxwp", "loadAllImages", "pixelRatio", "#fff", "getTempContainer", "find", "save", "promise", "css", "log", "message", "resolve", "getHtml", "error", "dpr", "catch", "now", "5661324okfktP", "length", "2871960IqdRwT", "portrait", "toPdf 失败(可能您的图片资源无法正常加载): ", "createTempContainer", "then", "removeTempContainer", "863130tpXBwe", "toCanvas", "6824JfAINS", "paperHeight", "417VbAEiW", "getContext", "getOrient", "svg2canvas", "floor", "toLocaleLowerCase", "4538hqpOpY", "toPdf percent: ", "width", "image/jpeg", ".hiprint-printPanel .hiprint-printPaper", "clear", "queue", "output", "isDownload", "hinnn", "height", "paperType", "onProgress", "Deferred", "addPage", "blob", "name", "printPanels", "getLayoutSize", "JPEG", ".pdf", "each"];
|
|
31
|
+
return q = function() {
|
|
32
|
+
return a;
|
|
33
|
+
}, q();
|
|
43
34
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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;
|
|
35
|
+
const Q = function(a, n, x) {
|
|
36
|
+
return R(this, null, function* () {
|
|
37
|
+
const e = b;
|
|
38
|
+
var r = this, s = globalThis.$[e(217)](), _ = !0;
|
|
39
|
+
let f = (p, T) => {
|
|
40
|
+
const l = e, w = Math[l(202)](p / T * 100);
|
|
41
|
+
console[l(245)]("cur", p, "total", T), console[l(245)](l(205), w + "%");
|
|
42
|
+
}, t = x || {};
|
|
43
|
+
if (this[e(221)][e(254)]) {
|
|
44
|
+
if (typeof n == "string") {
|
|
45
|
+
const c = n.indexOf(".pdf") > -1 ? n : n + e(224);
|
|
46
|
+
t.name = c;
|
|
47
|
+
} else t = n || {}, !t[e(220)] && (t.name = e(231) + Date[e(252)]() + e(224));
|
|
48
|
+
const p = this.printPanels[0];
|
|
49
|
+
let T = p[e(206)], l = p[e(214)];
|
|
50
|
+
const w = p[e(222)](), F = t[e(230)] || w[e(230)], J = t[e(264)] || w[e(264)], L = F && J;
|
|
51
|
+
var d = globalThis[e(213)].mm[e(233)](F || T), D = globalThis[e(213)].mm[e(233)](J || l), u = globalThis.$.extend({ backgroundColor: e(239) }, t || {});
|
|
52
|
+
const y = this[e(221)][0][e(215)], S = y != null && y != "" && y != "自定义", V = this[e(200)](0) == 1 || L ? e(256) : "landscape", j = S && !L ? y[e(203)]() : [d, D];
|
|
53
|
+
var v = new X({ orientation: V, unit: "pt", format: j }), I = yield this[e(248)](a, t);
|
|
54
|
+
t && (t[e(238)] && (u[e(250)] = t[e(238)], u[e(227)] = t[e(238)]), t[e(212)] != null && (_ = t[e(212)]), t.onProgress != null && (f = t[e(216)])), globalThis.$(I).css(e(206), "")[e(244)](e(214), ""), this[e(258)]();
|
|
55
|
+
var P = this[e(240)]();
|
|
56
|
+
this[e(201)](I, u), P[e(234)](I[0]), globalThis.$(I)[e(244)](e(229));
|
|
57
|
+
let A = P[e(241)](e(208)).length;
|
|
58
|
+
this[e(237)](P, function() {
|
|
59
|
+
const c = e;
|
|
119
60
|
try {
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
globalThis
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
var $ =
|
|
129
|
-
|
|
130
|
-
})
|
|
131
|
-
const
|
|
132
|
-
throw new Error(
|
|
61
|
+
P.find(c(208))[c(225)](function(g, E) {
|
|
62
|
+
const m = c;
|
|
63
|
+
globalThis.hinnn.queue.add(function(O) {
|
|
64
|
+
const o = b;
|
|
65
|
+
N[o(262)](E, u)[o(259)](function(h) {
|
|
66
|
+
const i = o;
|
|
67
|
+
var H = h[i(266)]("2d");
|
|
68
|
+
H.imageSmoothingEnabled = !1;
|
|
69
|
+
var $ = h.toDataURL(i(207), u[i(228)] || 0.92);
|
|
70
|
+
v.addImage($, i(223), 0, 0, d, D), g < A - 1 && v[i(218)](), f(g + 1, A), O();
|
|
71
|
+
})[o(251)]((h) => {
|
|
72
|
+
const i = o;
|
|
73
|
+
throw new Error(h[i(246)]);
|
|
133
74
|
});
|
|
134
|
-
}),
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
o.removeTempContainer(), C[s(304)](t.name);
|
|
75
|
+
}), g == A - 1 && (globalThis[m(213)].queue.add(function(O) {
|
|
76
|
+
const o = m;
|
|
77
|
+
if (_) r[o(260)](), v[o(242)](t[o(220)]);
|
|
138
78
|
else {
|
|
139
|
-
o
|
|
140
|
-
let
|
|
141
|
-
|
|
79
|
+
r[o(260)]();
|
|
80
|
+
let h = t.type || o(219), i = v[o(211)](h);
|
|
81
|
+
s[o(247)](i);
|
|
142
82
|
}
|
|
143
|
-
globalThis[
|
|
144
|
-
}), globalThis[
|
|
83
|
+
globalThis[o(213)].queue[o(209)]();
|
|
84
|
+
}), globalThis[m(213)][m(210)][m(232)]());
|
|
145
85
|
});
|
|
146
|
-
} catch (
|
|
147
|
-
console[c(
|
|
86
|
+
} catch (g) {
|
|
87
|
+
console[c(249)](c(257)), console.log(g);
|
|
148
88
|
}
|
|
149
89
|
});
|
|
150
90
|
}
|
|
151
|
-
return
|
|
91
|
+
return s[e(243)]();
|
|
152
92
|
});
|
|
153
93
|
};
|
|
154
|
-
|
|
155
|
-
|
|
94
|
+
function b(a, n) {
|
|
95
|
+
const x = q();
|
|
96
|
+
return b = function(e, r) {
|
|
97
|
+
return e = e - 200, x[e];
|
|
98
|
+
}, b(a, n);
|
|
99
|
+
}
|
|
100
|
+
function C(a, n) {
|
|
101
|
+
var x = k();
|
|
102
|
+
return C = function(e, r) {
|
|
103
|
+
e = e - 396;
|
|
104
|
+
var s = x[e];
|
|
105
|
+
return s;
|
|
106
|
+
}, C(a, n);
|
|
107
|
+
}
|
|
108
|
+
(function(a, n) {
|
|
109
|
+
for (var x = C, e = a(); ; )
|
|
156
110
|
try {
|
|
157
|
-
var
|
|
158
|
-
if (
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
x.push(x.shift());
|
|
111
|
+
var r = parseInt(x(396)) / 1 + parseInt(x(398)) / 2 + parseInt(x(400)) / 3 + parseInt(x(397)) / 4 * (-parseInt(x(406)) / 5) + parseInt(x(399)) / 6 + -parseInt(x(401)) / 7 * (-parseInt(x(403)) / 8) + -parseInt(x(407)) / 9;
|
|
112
|
+
if (r === n) break;
|
|
113
|
+
e.push(e.shift());
|
|
114
|
+
} catch (s) {
|
|
115
|
+
e.push(e.shift());
|
|
163
116
|
}
|
|
164
|
-
})(k,
|
|
117
|
+
})(k, 395772);
|
|
165
118
|
function k() {
|
|
166
|
-
var
|
|
119
|
+
var a = ["toPdf", "add toPdf Api", "40lbJPcP", "6646320yNvcgn", "newPrintTemplate", "add toPdf Api to PrintTemplate", "624876PapRUt", "176744DHsbRP", "666630qCbCOF", "2254572VtSQtV", "44274FIhXFl", "2681ANrpQJ", "0.3.0", "2904IqSAna"];
|
|
167
120
|
return k = function() {
|
|
168
|
-
return
|
|
121
|
+
return a;
|
|
169
122
|
}, k();
|
|
170
123
|
}
|
|
171
|
-
function
|
|
172
|
-
var
|
|
173
|
-
return
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}, D(n, e);
|
|
178
|
-
}
|
|
179
|
-
function F(n) {
|
|
180
|
-
var e = D;
|
|
181
|
-
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 }) => {
|
|
182
|
-
var o = e;
|
|
183
|
-
Object[o(171)](a, o(173), { value: H, enumerable: ![], writable: !![], configurable: !![] });
|
|
184
|
-
} }], leastHiprintVersion: e(179) };
|
|
124
|
+
function B(a) {
|
|
125
|
+
var n = C;
|
|
126
|
+
return { name: n(405), description: n(405), hooks: [{ hook: n(408), name: n(409), description: n(409), priority: 1, run: ({ template: x, options: e }) => {
|
|
127
|
+
var r = n;
|
|
128
|
+
Object.defineProperty(x, r(404), { value: Q, enumerable: !1, writable: !0, configurable: !0 });
|
|
129
|
+
} }], leastHiprintVersion: n(402) };
|
|
185
130
|
}
|
|
186
131
|
export {
|
|
187
|
-
|
|
132
|
+
B as default
|
|
188
133
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
(function(c
|
|
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,c){typeof exports=="object"&&typeof module!="undefined"?module.exports=c(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],c):(r=typeof globalThis!="undefined"?globalThis:r||self,r.pluginApiPdf=c(r.window,r.jspdf))})(this,function(r,c){"use strict";var E=(r,c,s)=>new Promise((A,d)=>{var l=n=>{try{b(s.next(n))}catch(x){d(x)}},u=n=>{try{b(s.throw(n))}catch(x){d(x)}},b=n=>n.done?A(n.value):Promise.resolve(n.value).then(l,u);b((s=s.apply(r,c)).next())});(function(n,x){const t=d,e=n();for(;;)try{if(-parseInt(t(235))/1*(-parseInt(t(204))/2)+parseInt(t(265))/3*(parseInt(t(263))/4)+-parseInt(t(261))/5+-parseInt(t(255))/6+parseInt(t(226))/7+-parseInt(t(236))/8+parseInt(t(253))/9===x)break;e.push(e.shift())}catch(i){e.push(e.shift())}})(s,805112);function s(){const n=["11019785djLDsd","scale","quality","position:fixed","paperWidth","sv-print-","run","toPt","html","254XFVcJv","12482824Zgxxwp","loadAllImages","pixelRatio","#fff","getTempContainer","find","save","promise","css","log","message","resolve","getHtml","error","dpr","catch","now","5661324okfktP","length","2871960IqdRwT","portrait","toPdf 失败(可能您的图片资源无法正常加载): ","createTempContainer","then","removeTempContainer","863130tpXBwe","toCanvas","6824JfAINS","paperHeight","417VbAEiW","getContext","getOrient","svg2canvas","floor","toLocaleLowerCase","4538hqpOpY","toPdf percent: ","width","image/jpeg",".hiprint-printPanel .hiprint-printPaper","clear","queue","output","isDownload","hinnn","height","paperType","onProgress","Deferred","addPage","blob","name","printPanels","getLayoutSize","JPEG",".pdf","each"];return s=function(){return n},s()}const A=function(n,x,t){return E(this,null,function*(){const e=d;var i=this,h=globalThis.$[e(217)](),D=!0;let F=(g,q)=>{const m=e,C=Math[m(202)](g/q*100);console[m(245)]("cur",g,"total",q),console[m(245)](m(205),C+"%")},o=t||{};if(this[e(221)][e(254)]){if(typeof x=="string"){const p=x.indexOf(".pdf")>-1?x:x+e(224);o.name=p}else o=x||{},!o[e(220)]&&(o.name=e(231)+Date[e(252)]()+e(224));const g=this.printPanels[0];let q=g[e(206)],m=g[e(214)];const C=g[e(222)](),O=o[e(230)]||C[e(230)],R=o[e(264)]||C[e(264)],S=O&&R;var J=globalThis[e(213)].mm[e(233)](O||q),L=globalThis[e(213)].mm[e(233)](R||m),v=globalThis.$.extend({backgroundColor:e(239)},o||{});const j=this[e(221)][0][e(215)],H=j!=null&&j!=""&&j!="自定义",$=this[e(200)](0)==1||S?e(256):"landscape",z=H&&!S?j[e(203)]():[J,L];var T=new c.jsPDF({orientation:$,unit:"pt",format:z}),w=yield this[e(248)](n,o);o&&(o[e(238)]&&(v[e(250)]=o[e(238)],v[e(227)]=o[e(238)]),o[e(212)]!=null&&(D=o[e(212)]),o.onProgress!=null&&(F=o[e(216)])),globalThis.$(w).css(e(206),"")[e(244)](e(214),""),this[e(258)]();var y=this[e(240)]();this[e(201)](w,v),y[e(234)](w[0]),globalThis.$(w)[e(244)](e(229));let k=y[e(241)](e(208)).length;this[e(237)](y,function(){const p=e;try{y.find(p(208))[p(225)](function(P,N){const I=p;globalThis.hinnn.queue.add(function(V){const a=d;r.snapdom[a(262)](N,v)[a(259)](function(_){const f=a;var X=_[f(266)]("2d");X.imageSmoothingEnabled=!1;var Q=_.toDataURL(f(207),v[f(228)]||.92);T.addImage(Q,f(223),0,0,J,L),P<k-1&&T[f(218)](),F(P+1,k),V()})[a(251)](_=>{const f=a;throw new Error(_[f(246)])})}),P==k-1&&(globalThis[I(213)].queue.add(function(V){const a=I;if(D)i[a(260)](),T[a(242)](o[a(220)]);else{i[a(260)]();let _=o.type||a(219),f=T[a(211)](_);h[a(247)](f)}globalThis[a(213)].queue[a(209)]()}),globalThis[I(213)][I(210)][I(232)]())})}catch(P){console[p(249)](p(257)),console.log(P)}})}return h[e(243)]()})};function d(n,x){const t=s();return d=function(e,i){return e=e-200,t[e]},d(n,x)}function l(n,x){var t=u();return l=function(e,i){e=e-396;var h=t[e];return h},l(n,x)}(function(n,x){for(var t=l,e=n();;)try{var i=parseInt(t(396))/1+parseInt(t(398))/2+parseInt(t(400))/3+parseInt(t(397))/4*(-parseInt(t(406))/5)+parseInt(t(399))/6+-parseInt(t(401))/7*(-parseInt(t(403))/8)+-parseInt(t(407))/9;if(i===x)break;e.push(e.shift())}catch(h){e.push(e.shift())}})(u,395772);function u(){var n=["toPdf","add toPdf Api","40lbJPcP","6646320yNvcgn","newPrintTemplate","add toPdf Api to PrintTemplate","624876PapRUt","176744DHsbRP","666630qCbCOF","2254572VtSQtV","44274FIhXFl","2681ANrpQJ","0.3.0","2904IqSAna"];return u=function(){return n},u()}function b(n){var x=l;return{name:x(405),description:x(405),hooks:[{hook:x(408),name:x(409),description:x(409),priority:1,run:({template:t,options:e})=>{var i=x;Object.defineProperty(t,i(404),{value:A,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:x(402)}}return b});
|