@sv-print/plugin-api-pdf3 0.2.0 → 0.2.1
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 +14 -12
- package/dist/index.mjs +134 -131
- package/dist/index.umd.js +14 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var q=(n,e,a)=>new Promise((x,o)=>{var h=t=>{try{b(a.next(t))}catch(m){o(m)}},w=t=>{try{b(a.throw(t))}catch(m){o(m)}},b=t=>t.done?x(t.value):Promise.resolve(t.value).then(h,w);b((a=a.apply(n,e)).next())});const Q=require("@zumer/snapdom"),E=require("jspdf");(function(n,e){const a=y,x=n();for(;[];)try{if(-parseInt(a(319))/1*(parseInt(a(300))/2)+parseInt(a(287))/3+parseInt(a(322))/4*(-parseInt(a(288))/5)+parseInt(a(344))/6*(parseInt(a(306))/7)+-parseInt(a(298))/8*(-parseInt(a(309))/9)+parseInt(a(340))/10+parseInt(a(261))/11*(-parseInt(a(280))/12)===e)break;x.push(x.shift())}catch(o){x.push(x.shift())}})(N,143229);function N(){const n=["scale",".hiprint-printPanel .hiprint-printPaper","now","ceil","1024690stCKRM","html","find","printPanels","165588RKyinY","svg2canvas","indexOf","getContext","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","paperType","resolve","114411ayAWjr","imageSmoothingEnabled","getOrient","panelLayoutOptions","quality","removeClass","each","hiprint-printPaper-small start-","position:fixed","toCanvas","hiprint-printPaper","total","error","length","queue","width","sv-print-","message","min","360NPVsac","layoutColumnGap","layoutType","name","add","paperWidth","addClass","735522GjlQOQ","480055gMmDMn",'<div class="hiprint-printPanel-small"></div>',"layoutRowGap","toLocaleLowerCase","toPdf percent: ","getHtml",".pdf","isDownload",`<div class="hiprint-printPanel">
|
|
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>
|
|
2
10
|
.hiprint-printPanel-small{
|
|
3
11
|
box-sizing: border-box;
|
|
4
12
|
border: 0px;
|
|
@@ -8,10 +16,11 @@
|
|
|
8
16
|
padding: 0;
|
|
9
17
|
}
|
|
10
18
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
11
|
-
margin: -`+(Number(i[x(
|
|
19
|
+
margin: -`+(Number(i[x(290)])||0)/2+x(329)+(Number(i.layoutColumnGap)||0)/2+`mm;
|
|
12
20
|
}
|
|
13
|
-
|
|
14
|
-
|
|
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>
|
|
15
24
|
.hiprint-printPanel-small{
|
|
16
25
|
box-sizing: border-box;
|
|
17
26
|
border: 0px;
|
|
@@ -25,11 +34,4 @@
|
|
|
25
34
|
flex-wrap: wrap;
|
|
26
35
|
flex-direction: column;
|
|
27
36
|
align-content: flex-start;
|
|
28
|
-
margin:
|
|
29
|
-
}
|
|
30
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
31
|
-
display:inline-block;
|
|
32
|
-
padding: `,"printPanels","resolve","log","465JYscVO","queue","paperWidth","getContext","1830570nhlfoR","name","isDownload","length","toLocaleLowerCase","453RnbkRT","extend","824JuXcAV",".hiprint-printPanel .hiprint-printPaper","css","createTempContainer","hiprint-printPaper","57762hBjdeZ","row","svg2canvas","position:fixed","addImage",'<div class="hiprint-printTemplate"></div>',"hinnn","output","height","catch","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","layoutType","mm -",`<div class="hiprint-printPanel">
|
|
33
|
-
<div class="hiprint-printPaper" style="width:`,"width","toPt","now","toDataURL","indexOf","21820PdnyNC","11739024gYkaDO",`mm;
|
|
34
|
-
}
|
|
35
|
-
</style>`,".pdf","pixelRatio","clone","addPage","append","image/jpeg","imageSmoothingEnabled","dpr","JPEG","min","layoutColumnGap","then","loadAllImages","onProgress",".hiprint-printPaper","find"];return q=function(){return n},q()}(function(n,a){for(var e=M,x=n();[];)try{var o=parseInt(e(491))/1*(-parseInt(e(490))/2)+parseInt(e(495))/3+-parseInt(e(487))/4+parseInt(e(484))/5*(parseInt(e(494))/6)+-parseInt(e(493))/7*(parseInt(e(488))/8)+-parseInt(e(497))/9+parseInt(e(485))/10;if(o===a)break;x.push(x.shift())}catch(c){x.push(x.shift())}})($,444814);function M(n,a){var e=$();return M=function(x,o){x=x-484;var c=e[x];return c},M(n,a)}function $(){var n=["11800220KdCSqW","add toPdf Api to PrintTemplate","149712dcKDWM","36112hbQYCs","toPdf","31846ymriPr","23eWdTxC","newPrintTemplate","602uMlddO","44490VKEqul","1166520yrTloY","add toPdf Api","5859288JZXlPB","215YCzUPc"];return $=function(){return n},$()}function K(n){var a=M;return{name:a(496),description:a(496),hooks:[{hook:a(492),name:a(486),description:a(486),priority:1,run:({template:e,options:x})=>{var o=a;Object.defineProperty(e,o(489),{value:J,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}module.exports=K;
|
|
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;
|
package/dist/index.mjs
CHANGED
|
@@ -1,63 +1,77 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var O = (n, e, a) => new Promise((x, o) => {
|
|
2
|
+
var h = (t) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
4
|
+
b(a.next(t));
|
|
5
5
|
} catch (m) {
|
|
6
6
|
o(m);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, w = (t) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
b(a.throw(t));
|
|
11
11
|
} catch (m) {
|
|
12
12
|
o(m);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, b = (t) => t.done ? x(t.value) : Promise.resolve(t.value).then(h, w);
|
|
15
|
+
b((a = a.apply(n, e)).next());
|
|
16
16
|
});
|
|
17
|
-
import { snapdom as
|
|
18
|
-
import { jsPDF as
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
return T = function(x, o) {
|
|
22
|
-
return x = x - 167, e[x];
|
|
23
|
-
}, T(n, a);
|
|
24
|
-
}
|
|
25
|
-
(function(n, a) {
|
|
26
|
-
const e = T, x = n();
|
|
17
|
+
import { snapdom as z } from "@zumer/snapdom";
|
|
18
|
+
import { jsPDF as E } from "jspdf";
|
|
19
|
+
(function(n, e) {
|
|
20
|
+
const a = y, x = n();
|
|
27
21
|
for (; []; )
|
|
28
22
|
try {
|
|
29
|
-
if (parseInt(
|
|
23
|
+
if (-parseInt(a(319)) / 1 * (parseInt(a(300)) / 2) + parseInt(a(287)) / 3 + parseInt(a(322)) / 4 * (-parseInt(a(288)) / 5) + parseInt(a(344)) / 6 * (parseInt(a(306)) / 7) + -parseInt(a(298)) / 8 * (-parseInt(a(309)) / 9) + parseInt(a(340)) / 10 + parseInt(a(261)) / 11 * (-parseInt(a(280)) / 12) === e)
|
|
30
24
|
break;
|
|
31
25
|
x.push(x.shift());
|
|
32
26
|
} catch (o) {
|
|
33
27
|
x.push(x.shift());
|
|
34
28
|
}
|
|
35
|
-
})(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
29
|
+
})(N, 143229);
|
|
30
|
+
function N() {
|
|
31
|
+
const n = ["scale", ".hiprint-printPanel .hiprint-printPaper", "now", "ceil", "1024690stCKRM", "html", "find", "printPanels", "165588RKyinY", "svg2canvas", "indexOf", "getContext", "toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "paperType", "resolve", "114411ayAWjr", "imageSmoothingEnabled", "getOrient", "panelLayoutOptions", "quality", "removeClass", "each", "hiprint-printPaper-small start-", "position:fixed", "toCanvas", "hiprint-printPaper", "total", "error", "length", "queue", "width", "sv-print-", "message", "min", "360NPVsac", "layoutColumnGap", "layoutType", "name", "add", "paperWidth", "addClass", "735522GjlQOQ", "480055gMmDMn", '<div class="hiprint-printPanel-small"></div>', "layoutRowGap", "toLocaleLowerCase", "toPdf percent: ", "getHtml", ".pdf", "isDownload", `<div class="hiprint-printPanel">
|
|
32
|
+
<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>
|
|
33
|
+
</div>`, "63397avRfSw", "mm ", "floor", "8iPKQQR", "row", "clear", "createTempContainer", "run", "image/jpeg", `mm;
|
|
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();
|
|
43
|
+
}
|
|
44
|
+
function y(n, e) {
|
|
45
|
+
const a = N();
|
|
46
|
+
return y = function(x, o) {
|
|
47
|
+
return x = x - 259, a[x];
|
|
48
|
+
}, y(n, e);
|
|
49
|
+
}
|
|
50
|
+
const H = function(n, e, a) {
|
|
51
|
+
return O(this, null, function* () {
|
|
52
|
+
const x = y;
|
|
53
|
+
var o = this, h = globalThis.$.Deferred(), w = !![];
|
|
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;
|
|
48
62
|
} else
|
|
49
|
-
t =
|
|
50
|
-
let P = this[x(
|
|
51
|
-
var m = globalThis.
|
|
52
|
-
const
|
|
53
|
-
var
|
|
54
|
-
t && (t
|
|
55
|
-
var
|
|
56
|
-
if (
|
|
57
|
-
let
|
|
58
|
-
const
|
|
59
|
-
let
|
|
60
|
-
i[x(
|
|
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>
|
|
61
75
|
.hiprint-printPanel-small{
|
|
62
76
|
box-sizing: border-box;
|
|
63
77
|
border: 0px;
|
|
@@ -67,119 +81,108 @@ const K = function(n, a, e) {
|
|
|
67
81
|
padding: 0;
|
|
68
82
|
}
|
|
69
83
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
70
|
-
margin: -` + (Number(i[x(
|
|
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;
|
|
71
92
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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);
|
|
80
110
|
}
|
|
81
|
-
|
|
111
|
+
l[x(316)](M);
|
|
82
112
|
}
|
|
83
|
-
this[x(
|
|
113
|
+
this[x(345)](l, u), v[x(341)](l[0]), globalThis.$(l)[x(312)](x(269));
|
|
84
114
|
} else
|
|
85
|
-
this
|
|
86
|
-
let
|
|
87
|
-
this
|
|
88
|
-
const
|
|
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;
|
|
89
119
|
try {
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
globalThis[
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
const r =
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
})
|
|
101
|
-
|
|
120
|
+
v[c(342)](c(337))[c(267)](function(f, T) {
|
|
121
|
+
const p = c;
|
|
122
|
+
globalThis[p(299)][p(275)][p(284)](function(I) {
|
|
123
|
+
const s = p;
|
|
124
|
+
z[s(270)](T, u)[s(307)](function(l) {
|
|
125
|
+
const r = s;
|
|
126
|
+
var M = l[r(347)]("2d");
|
|
127
|
+
M[r(262)] = ![];
|
|
128
|
+
var $ = l[r(310)](r(327), u[r(265)] || 0.92);
|
|
129
|
+
C[r(305)]($, r(313), 0, 0, m, A), f < G - 1 && C.addPage(), b(f + 1, G), I();
|
|
130
|
+
}).catch((l) => {
|
|
131
|
+
const r = s;
|
|
132
|
+
throw new Error(l[r(278)]);
|
|
102
133
|
});
|
|
103
|
-
}),
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
o.removeTempContainer(),
|
|
134
|
+
}), f == G - 1 && (globalThis[p(299)][p(275)][p(284)](function(I) {
|
|
135
|
+
const s = p;
|
|
136
|
+
if (w)
|
|
137
|
+
o.removeTempContainer(), C[s(304)](t.name);
|
|
107
138
|
else {
|
|
108
139
|
o.removeTempContainer();
|
|
109
|
-
let
|
|
110
|
-
|
|
140
|
+
let l = t[s(332)] || s(330), r = C.output(l);
|
|
141
|
+
h[s(260)](r);
|
|
111
142
|
}
|
|
112
|
-
globalThis[
|
|
113
|
-
}), globalThis
|
|
143
|
+
globalThis[s(299)][s(275)][s(324)]();
|
|
144
|
+
}), globalThis[p(299)][p(275)][p(326)]());
|
|
114
145
|
});
|
|
115
|
-
} catch (
|
|
116
|
-
console[
|
|
146
|
+
} catch (f) {
|
|
147
|
+
console[c(273)](c(348)), console[c(297)](f);
|
|
117
148
|
}
|
|
118
149
|
});
|
|
119
150
|
}
|
|
120
|
-
return
|
|
151
|
+
return h.promise();
|
|
121
152
|
});
|
|
122
153
|
};
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
</div>`, "hiprint-printPaper-small start-", "817870sRwNtd", "floor", "addClass", "panelLayoutOptions", "portrait", "cur", "save", "36393lfxVEX", "\u81EA\u5B9A\u4E49", "mm;height:", `<style>
|
|
126
|
-
.hiprint-printPanel-small{
|
|
127
|
-
box-sizing: border-box;
|
|
128
|
-
border: 0px;
|
|
129
|
-
}
|
|
130
|
-
.hiprint-printPaper-small{
|
|
131
|
-
position: relative;
|
|
132
|
-
padding: 0;
|
|
133
|
-
}
|
|
134
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
135
|
-
display: flex;
|
|
136
|
-
flex-wrap: wrap;
|
|
137
|
-
flex-direction: column;
|
|
138
|
-
align-content: flex-start;
|
|
139
|
-
margin: -`, "mm ", `mm;
|
|
140
|
-
}
|
|
141
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
142
|
-
display:inline-block;
|
|
143
|
-
padding: `, "printPanels", "resolve", "log", "465JYscVO", "queue", "paperWidth", "getContext", "1830570nhlfoR", "name", "isDownload", "length", "toLocaleLowerCase", "453RnbkRT", "extend", "824JuXcAV", ".hiprint-printPanel .hiprint-printPaper", "css", "createTempContainer", "hiprint-printPaper", "57762hBjdeZ", "row", "svg2canvas", "position:fixed", "addImage", '<div class="hiprint-printTemplate"></div>', "hinnn", "output", "height", "catch", "toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "layoutType", "mm -", `<div class="hiprint-printPanel">
|
|
144
|
-
<div class="hiprint-printPaper" style="width:`, "width", "toPt", "now", "toDataURL", "indexOf", "21820PdnyNC", "11739024gYkaDO", `mm;
|
|
145
|
-
}
|
|
146
|
-
</style>`, ".pdf", "pixelRatio", "clone", "addPage", "append", "image/jpeg", "imageSmoothingEnabled", "dpr", "JPEG", "min", "layoutColumnGap", "then", "loadAllImages", "onProgress", ".hiprint-printPaper", "find"];
|
|
147
|
-
return M = function() {
|
|
148
|
-
return n;
|
|
149
|
-
}, M();
|
|
150
|
-
}
|
|
151
|
-
(function(n, a) {
|
|
152
|
-
for (var e = $, x = n(); []; )
|
|
154
|
+
(function(n, e) {
|
|
155
|
+
for (var a = D, x = n(); []; )
|
|
153
156
|
try {
|
|
154
|
-
var o = parseInt(
|
|
155
|
-
if (o ===
|
|
157
|
+
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);
|
|
158
|
+
if (o === e)
|
|
156
159
|
break;
|
|
157
160
|
x.push(x.shift());
|
|
158
|
-
} catch (
|
|
161
|
+
} catch (h) {
|
|
159
162
|
x.push(x.shift());
|
|
160
163
|
}
|
|
161
|
-
})(k,
|
|
162
|
-
function $(n, a) {
|
|
163
|
-
var e = k();
|
|
164
|
-
return $ = function(x, o) {
|
|
165
|
-
x = x - 484;
|
|
166
|
-
var c = e[x];
|
|
167
|
-
return c;
|
|
168
|
-
}, $(n, a);
|
|
169
|
-
}
|
|
164
|
+
})(k, 773925);
|
|
170
165
|
function k() {
|
|
171
|
-
var n = ["
|
|
166
|
+
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"];
|
|
172
167
|
return k = function() {
|
|
173
168
|
return n;
|
|
174
169
|
}, k();
|
|
175
170
|
}
|
|
176
|
-
function
|
|
177
|
-
var a =
|
|
178
|
-
return
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
171
|
+
function D(n, e) {
|
|
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);
|
|
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) };
|
|
182
185
|
}
|
|
183
186
|
export {
|
|
184
|
-
|
|
187
|
+
F as default
|
|
185
188
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
(function(c,
|
|
1
|
+
(function(c,m){typeof exports=="object"&&typeof module!="undefined"?module.exports=m(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],m):(c=typeof globalThis!="undefined"?globalThis:c||self,c.pluginApiPdf=m(c.window,c.jspdf))})(this,function(c,m){"use strict";var Q=(c,m,f)=>new Promise((b,N)=>{var g=n=>{try{T(f.next(n))}catch(a){N(a)}},v=n=>{try{T(f.throw(n))}catch(a){N(a)}},T=n=>n.done?b(n.value):Promise.resolve(n.value).then(g,v);T((f=f.apply(c,m)).next())});(function(n,a){const t=b,x=n();for(;[];)try{if(-parseInt(t(319))/1*(parseInt(t(300))/2)+parseInt(t(287))/3+parseInt(t(322))/4*(-parseInt(t(288))/5)+parseInt(t(344))/6*(parseInt(t(306))/7)+-parseInt(t(298))/8*(-parseInt(t(309))/9)+parseInt(t(340))/10+parseInt(t(261))/11*(-parseInt(t(280))/12)===a)break;x.push(x.shift())}catch(l){x.push(x.shift())}})(f,143229);function f(){const n=["scale",".hiprint-printPanel .hiprint-printPaper","now","ceil","1024690stCKRM","html","find","printPanels","165588RKyinY","svg2canvas","indexOf","getContext","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","paperType","resolve","114411ayAWjr","imageSmoothingEnabled","getOrient","panelLayoutOptions","quality","removeClass","each","hiprint-printPaper-small start-","position:fixed","toCanvas","hiprint-printPaper","total","error","length","queue","width","sv-print-","message","min","360NPVsac","layoutColumnGap","layoutType","name","add","paperWidth","addClass","735522GjlQOQ","480055gMmDMn",'<div class="hiprint-printPanel-small"></div>',"layoutRowGap","toLocaleLowerCase","toPdf percent: ","getHtml",".pdf","isDownload",`<div class="hiprint-printPanel">
|
|
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>
|
|
2
10
|
.hiprint-printPanel-small{
|
|
3
11
|
box-sizing: border-box;
|
|
4
12
|
border: 0px;
|
|
@@ -8,10 +16,11 @@
|
|
|
8
16
|
padding: 0;
|
|
9
17
|
}
|
|
10
18
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
11
|
-
margin: -`+(Number(i[x(
|
|
19
|
+
margin: -`+(Number(i[x(290)])||0)/2+x(329)+(Number(i.layoutColumnGap)||0)/2+`mm;
|
|
12
20
|
}
|
|
13
|
-
|
|
14
|
-
|
|
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>
|
|
15
24
|
.hiprint-printPanel-small{
|
|
16
25
|
box-sizing: border-box;
|
|
17
26
|
border: 0px;
|
|
@@ -25,11 +34,4 @@
|
|
|
25
34
|
flex-wrap: wrap;
|
|
26
35
|
flex-direction: column;
|
|
27
36
|
align-content: flex-start;
|
|
28
|
-
margin:
|
|
29
|
-
}
|
|
30
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
31
|
-
display:inline-block;
|
|
32
|
-
padding: `,"printPanels","resolve","log","465JYscVO","queue","paperWidth","getContext","1830570nhlfoR","name","isDownload","length","toLocaleLowerCase","453RnbkRT","extend","824JuXcAV",".hiprint-printPanel .hiprint-printPaper","css","createTempContainer","hiprint-printPaper","57762hBjdeZ","row","svg2canvas","position:fixed","addImage",'<div class="hiprint-printTemplate"></div>',"hinnn","output","height","catch","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","layoutType","mm -",`<div class="hiprint-printPanel">
|
|
33
|
-
<div class="hiprint-printPaper" style="width:`,"width","toPt","now","toDataURL","indexOf","21820PdnyNC","11739024gYkaDO",`mm;
|
|
34
|
-
}
|
|
35
|
-
</style>`,".pdf","pixelRatio","clone","addPage","append","image/jpeg","imageSmoothingEnabled","dpr","JPEG","min","layoutColumnGap","then","loadAllImages","onProgress",".hiprint-printPaper","find"];return u=function(){return a},u()}(function(a,t){for(var e=g,x=a();[];)try{var l=parseInt(e(491))/1*(-parseInt(e(490))/2)+parseInt(e(495))/3+-parseInt(e(487))/4+parseInt(e(484))/5*(parseInt(e(494))/6)+-parseInt(e(493))/7*(parseInt(e(488))/8)+-parseInt(e(497))/9+parseInt(e(485))/10;if(l===t)break;x.push(x.shift())}catch(v){x.push(x.shift())}})(P,444814);function g(a,t){var e=P();return g=function(x,l){x=x-484;var v=e[x];return v},g(a,t)}function P(){var a=["11800220KdCSqW","add toPdf Api to PrintTemplate","149712dcKDWM","36112hbQYCs","toPdf","31846ymriPr","23eWdTxC","newPrintTemplate","602uMlddO","44490VKEqul","1166520yrTloY","add toPdf Api","5859288JZXlPB","215YCzUPc"];return P=function(){return a},P()}function T(a){var t=g;return{name:t(496),description:t(496),hooks:[{hook:t(492),name:t(486),description:t(486),priority:1,run:({template:e,options:x})=>{var l=t;Object.defineProperty(e,l(489),{value:$,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}return T});
|
|
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});
|