@sv-print/plugin-api-pdf3 0.2.2 → 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 CHANGED
@@ -1 +1 @@
1
- "use strict";var k=(a,n,e)=>new Promise((x,r)=>{var p=t=>{try{l(e.next(t))}catch(f){r(f)}},m=t=>{try{l(e.throw(t))}catch(f){r(f)}},l=t=>t.done?x(t.value):Promise.resolve(t.value).then(p,m);l((e=e.apply(a,n)).next())});const B=require("@zumer/snapdom"),H=require("jspdf");(function(a,n){const e=q,x=a();for(;;)try{if(-parseInt(e(364))/1*(-parseInt(e(353))/2)+-parseInt(e(341))/3*(parseInt(e(378))/4)+parseInt(e(347))/5+parseInt(e(351))/6*(parseInt(e(369))/7)+parseInt(e(371))/8+-parseInt(e(374))/9+-parseInt(e(352))/10*(parseInt(e(334))/11)===n)break;x.push(x.shift())}catch(r){x.push(x.shift())}})(w,319677);const W=function(a,n,e){return k(this,null,function*(){const x=q;var r=this,p=globalThis.$[x(340)](),m=!0;let l=(P,T)=>{const c=x,d=Math[c(361)](P/T*100);console[c(319)](c(377),P,"total",T),console[c(319)](c(372),d+"%")},t=e||{};if(this[x(382)][x(327)]){if(typeof n===x(375)){const o=n[x(367)](x(365))>-1?n:n+x(365);t[x(360)]=o}else t=n||{},!t[x(360)]&&(t.name=x(362)+Date[x(344)]()+x(365));let P=this[x(382)][0][x(333)],T=this[x(382)][0][x(348)];const c=t[x(343)]&&t[x(330)];var f=globalThis[x(363)].mm[x(323)](t[x(343)]||P),C=globalThis.hinnn.mm[x(323)](t[x(330)]||T),u=globalThis.$[x(338)]({backgroundColor:x(329)},t||{});const d=this[x(382)][0][x(335)],R=d!=null&&d!=""&&d!=x(376),X=this[x(321)](0)==1||c?x(328):"landscape",E=R&&!c?d[x(332)]():[f,C];var v=new H.jsPDF({orientation:X,unit:"pt",format:E}),_=yield this.getHtml(a,t);t&&(t[x(326)]&&(u[x(346)]=t.pixelRatio,u[x(368)]=t[x(326)]),t[x(379)]!=null&&(m=t[x(379)]),t[x(336)]!=null&&(l=t[x(336)])),globalThis.$(_)[x(355)]("width","")[x(355)](x(348),""),this[x(325)]();var I=this[x(342)]();this[x(331)](_,u),I[x(337)](_[0]),globalThis.$(_)[x(355)](x(324));let A=I[x(354)](x(381)).length;this[x(370)](I,function(){const o=x;try{I[o(354)](o(381))[o(345)](function(b,G){const i=o;globalThis[i(363)][i(322)][i(358)](function(j){const s=i;B.snapdom.toCanvas(G,u)[s(318)](function(h){const g=s;var O=h[g(366)]("2d");O[g(356)]=!1;var Z=h.toDataURL("image/jpeg",u.quality||.92);v.addImage(Z,g(320),0,0,f,C),b<A-1&&v.addPage(),l(b+1,A),j()})[s(350)](h=>{throw new Error(h.message)})}),b==A-1&&(globalThis.hinnn.queue[i(358)](function(j){const s=i;if(m)r.removeTempContainer(),v[s(349)](t[s(360)]);else{r[s(359)]();let h=t[s(373)]||"blob",g=v.output(h);p.resolve(g)}globalThis[s(363)].queue.clear()}),globalThis[i(363)][i(322)][i(380)]())})}catch(b){console[o(339)](o(357)),console[o(319)](b)}})}return p.promise()})};function q(a,n){const e=w();return q=function(x,r){return x=x-318,e[x]},q(a,n)}function w(){const a=["save","catch","1270116jXYvDl","10isvtQq","134FXOcys","find","css","imageSmoothingEnabled","toPdf 失败(可能您的图片资源无法正常加载): ","add","removeTempContainer","name","floor","sv-print-","hinnn","2913lJqTSb",".pdf","getContext","indexOf","scale","7ephwfs","loadAllImages","2436640DEXpzD","toPdf percent: ","type","4154787eMEquO","string","自定义","cur","11468BswBuP","isDownload","run",".hiprint-printPanel .hiprint-printPaper","printPanels","then","log","JPEG","getOrient","queue","toPt","position:fixed","createTempContainer","pixelRatio","length","portrait","#fff","paperHeight","svg2canvas","toLocaleLowerCase","width","565334qhgZZz","paperType","onProgress","html","extend","error","Deferred","183uXkDZV","getTempContainer","paperWidth","now","each","dpr","1480820qWimoZ","height"];return w=function(){return a},w()}function y(){var a=["2979GBpDqr","add toPdf Api","4575935rhWZqJ","918DcynHl","toPdf","1523658KGpjTG","defineProperty","1531140yqUKYr","46392ARDXSt","230qAbAyB","newPrintTemplate","5242002lfWGRM","2950684ipXaaP","5TaYwDD","0.3.0","add toPdf Api to PrintTemplate","176VhqARN"];return y=function(){return a},y()}(function(a,n){for(var e=D,x=a();;)try{var r=-parseInt(e(324))/1*(parseInt(e(316))/2)+-parseInt(e(329))/3+-parseInt(e(319))/4+-parseInt(e(320))/5*(-parseInt(e(318))/6)+-parseInt(e(326))/7+parseInt(e(315))/8*(-parseInt(e(327))/9)+-parseInt(e(314))/10*(-parseInt(e(323))/11);if(r===n)break;x.push(x.shift())}catch(p){x.push(x.shift())}})(y,490146);function D(a,n){var e=y();return D=function(x,r){x=x-314;var p=e[x];return p},D(a,n)}function $(a){var n=D;return{name:n(325),description:"add toPdf Api",hooks:[{hook:n(317),name:n(322),description:n(322),priority:1,run:({template:e,options:x})=>{var r=n;Object[r(330)](e,r(328),{value:W,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(321)}}module.exports=$;
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,131 +1,133 @@
1
- var R = (a, n, t) => new Promise((x, r) => {
2
- var p = (e) => {
1
+ var R = (a, n, x) => new Promise((e, r) => {
2
+ var s = (t) => {
3
3
  try {
4
- c(t.next(e));
5
- } catch (f) {
6
- r(f);
4
+ f(x.next(t));
5
+ } catch (d) {
6
+ r(d);
7
7
  }
8
- }, m = (e) => {
8
+ }, _ = (t) => {
9
9
  try {
10
- c(t.throw(e));
11
- } catch (f) {
12
- r(f);
10
+ f(x.throw(t));
11
+ } catch (d) {
12
+ r(d);
13
13
  }
14
- }, c = (e) => e.done ? x(e.value) : Promise.resolve(e.value).then(p, m);
15
- c((t = t.apply(a, n)).next());
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 B } from "@zumer/snapdom";
18
- import { jsPDF as H } from "jspdf";
17
+ import { snapdom as N } from "@zumer/snapdom";
18
+ import { jsPDF as X } from "jspdf";
19
19
  (function(a, n) {
20
- const t = w, x = a();
20
+ const x = b, e = a();
21
21
  for (; ; )
22
22
  try {
23
- if (-parseInt(t(364)) / 1 * (-parseInt(t(353)) / 2) + -parseInt(t(341)) / 3 * (parseInt(t(378)) / 4) + parseInt(t(347)) / 5 + parseInt(t(351)) / 6 * (parseInt(t(369)) / 7) + parseInt(t(371)) / 8 + -parseInt(t(374)) / 9 + -parseInt(t(352)) / 10 * (parseInt(t(334)) / 11) === n) break;
24
- 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
25
  } catch (r) {
26
- x.push(x.shift());
26
+ e.push(e.shift());
27
27
  }
28
- })(q, 319677);
29
- const W = function(a, n, t) {
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();
34
+ }
35
+ const Q = function(a, n, x) {
30
36
  return R(this, null, function* () {
31
- const x = w;
32
- var r = this, p = globalThis.$[x(340)](), m = !0;
33
- let c = (P, T) => {
34
- const l = x, h = Math[l(361)](P / T * 100);
35
- console[l(319)](l(377), P, "total", T), console[l(319)](l(372), h + "%");
36
- }, e = t || {};
37
- if (this[x(382)][x(327)]) {
38
- if (typeof n === x(375)) {
39
- const o = n[x(367)](x(365)) > -1 ? n : n + x(365);
40
- e[x(360)] = o;
41
- } else e = n || {}, !e[x(360)] && (e.name = x(362) + Date[x(344)]() + x(365));
42
- let P = this[x(382)][0][x(333)], T = this[x(382)][0][x(348)];
43
- const l = e[x(343)] && e[x(330)];
44
- var f = globalThis[x(363)].mm[x(323)](e[x(343)] || P), C = globalThis.hinnn.mm[x(323)](e[x(330)] || T), u = globalThis.$[x(338)]({ backgroundColor: x(329) }, e || {});
45
- const h = this[x(382)][0][x(335)], X = h != null && h != "" && h != x(376), j = this[x(321)](0) == 1 || l ? x(328) : "landscape", E = X && !l ? h[x(332)]() : [f, C];
46
- var v = new H({ orientation: j, unit: "pt", format: E }), _ = yield this.getHtml(a, e);
47
- e && (e[x(326)] && (u[x(346)] = e.pixelRatio, u[x(368)] = e[x(326)]), e[x(379)] != null && (m = e[x(379)]), e[x(336)] != null && (c = e[x(336)])), globalThis.$(_)[x(355)]("width", "")[x(355)](x(348), ""), this[x(325)]();
48
- var I = this[x(342)]();
49
- this[x(331)](_, u), I[x(337)](_[0]), globalThis.$(_)[x(355)](x(324));
50
- let A = I[x(354)](x(381)).length;
51
- this[x(370)](I, function() {
52
- const o = x;
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;
53
60
  try {
54
- I[o(354)](o(381))[o(345)](function(b, G) {
55
- const i = o;
56
- globalThis[i(363)][i(322)][i(358)](function(k) {
57
- const s = i;
58
- B.toCanvas(G, u)[s(318)](function(d) {
59
- const g = s;
60
- var O = d[g(366)]("2d");
61
- O[g(356)] = !1;
62
- var Z = d.toDataURL("image/jpeg", u.quality || 0.92);
63
- v.addImage(Z, g(320), 0, 0, f, C), b < A - 1 && v.addPage(), c(b + 1, A), k();
64
- })[s(350)]((d) => {
65
- throw new Error(d.message);
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)]);
66
74
  });
67
- }), b == A - 1 && (globalThis.hinnn.queue[i(358)](function(k) {
68
- const s = i;
69
- if (m) r.removeTempContainer(), v[s(349)](e[s(360)]);
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)]);
70
78
  else {
71
- r[s(359)]();
72
- let d = e[s(373)] || "blob", g = v.output(d);
73
- p.resolve(g);
79
+ r[o(260)]();
80
+ let h = t.type || o(219), i = v[o(211)](h);
81
+ s[o(247)](i);
74
82
  }
75
- globalThis[s(363)].queue.clear();
76
- }), globalThis[i(363)][i(322)][i(380)]());
83
+ globalThis[o(213)].queue[o(209)]();
84
+ }), globalThis[m(213)][m(210)][m(232)]());
77
85
  });
78
- } catch (b) {
79
- console[o(339)](o(357)), console[o(319)](b);
86
+ } catch (g) {
87
+ console[c(249)](c(257)), console.log(g);
80
88
  }
81
89
  });
82
90
  }
83
- return p.promise();
91
+ return s[e(243)]();
84
92
  });
85
93
  };
86
- function w(a, n) {
87
- const t = q();
88
- return w = function(x, r) {
89
- return x = x - 318, t[x];
90
- }, w(a, n);
91
- }
92
- function q() {
93
- const a = ["save", "catch", "1270116jXYvDl", "10isvtQq", "134FXOcys", "find", "css", "imageSmoothingEnabled", "toPdf 失败(可能您的图片资源无法正常加载): ", "add", "removeTempContainer", "name", "floor", "sv-print-", "hinnn", "2913lJqTSb", ".pdf", "getContext", "indexOf", "scale", "7ephwfs", "loadAllImages", "2436640DEXpzD", "toPdf percent: ", "type", "4154787eMEquO", "string", "自定义", "cur", "11468BswBuP", "isDownload", "run", ".hiprint-printPanel .hiprint-printPaper", "printPanels", "then", "log", "JPEG", "getOrient", "queue", "toPt", "position:fixed", "createTempContainer", "pixelRatio", "length", "portrait", "#fff", "paperHeight", "svg2canvas", "toLocaleLowerCase", "width", "565334qhgZZz", "paperType", "onProgress", "html", "extend", "error", "Deferred", "183uXkDZV", "getTempContainer", "paperWidth", "now", "each", "dpr", "1480820qWimoZ", "height"];
94
- return q = function() {
95
- return a;
96
- }, q();
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);
97
99
  }
98
- function y() {
99
- var a = ["2979GBpDqr", "add toPdf Api", "4575935rhWZqJ", "918DcynHl", "toPdf", "1523658KGpjTG", "defineProperty", "1531140yqUKYr", "46392ARDXSt", "230qAbAyB", "newPrintTemplate", "5242002lfWGRM", "2950684ipXaaP", "5TaYwDD", "0.3.0", "add toPdf Api to PrintTemplate", "176VhqARN"];
100
- return y = function() {
101
- return a;
102
- }, y();
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);
103
107
  }
104
108
  (function(a, n) {
105
- for (var t = D, x = a(); ; )
109
+ for (var x = C, e = a(); ; )
106
110
  try {
107
- var r = -parseInt(t(324)) / 1 * (parseInt(t(316)) / 2) + -parseInt(t(329)) / 3 + -parseInt(t(319)) / 4 + -parseInt(t(320)) / 5 * (-parseInt(t(318)) / 6) + -parseInt(t(326)) / 7 + parseInt(t(315)) / 8 * (-parseInt(t(327)) / 9) + -parseInt(t(314)) / 10 * (-parseInt(t(323)) / 11);
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;
108
112
  if (r === n) break;
109
- x.push(x.shift());
110
- } catch (p) {
111
- x.push(x.shift());
113
+ e.push(e.shift());
114
+ } catch (s) {
115
+ e.push(e.shift());
112
116
  }
113
- })(y, 490146);
114
- function D(a, n) {
115
- var t = y();
116
- return D = function(x, r) {
117
- x = x - 314;
118
- var p = t[x];
119
- return p;
120
- }, D(a, n);
117
+ })(k, 395772);
118
+ function k() {
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"];
120
+ return k = function() {
121
+ return a;
122
+ }, k();
121
123
  }
122
- function M(a) {
123
- var n = D;
124
- return { name: n(325), description: "add toPdf Api", hooks: [{ hook: n(317), name: n(322), description: n(322), priority: 1, run: ({ template: t, options: x }) => {
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 }) => {
125
127
  var r = n;
126
- Object[r(330)](t, r(328), { value: W, enumerable: !1, writable: !0, configurable: !0 });
127
- } }], leastHiprintVersion: n(321) };
128
+ Object.defineProperty(x, r(404), { value: Q, enumerable: !1, writable: !0, configurable: !0 });
129
+ } }], leastHiprintVersion: n(402) };
128
130
  }
129
131
  export {
130
- M as default
132
+ B as default
131
133
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(r,d){typeof exports=="object"&&typeof module!="undefined"?module.exports=d(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],d):(r=typeof globalThis!="undefined"?globalThis:r||self,r.pluginApiPdf=d(r.window,r.jspdf))})(this,function(r,d){"use strict";var G=(r,d,l)=>new Promise((u,c)=>{var h=n=>{try{_(l.next(n))}catch(t){c(t)}},b=n=>{try{_(l.throw(n))}catch(t){c(t)}},_=n=>n.done?u(n.value):Promise.resolve(n.value).then(h,b);_((l=l.apply(r,d)).next())});(function(n,t){const x=u,e=n();for(;;)try{if(-parseInt(x(364))/1*(-parseInt(x(353))/2)+-parseInt(x(341))/3*(parseInt(x(378))/4)+parseInt(x(347))/5+parseInt(x(351))/6*(parseInt(x(369))/7)+parseInt(x(371))/8+-parseInt(x(374))/9+-parseInt(x(352))/10*(parseInt(x(334))/11)===t)break;e.push(e.shift())}catch(i){e.push(e.shift())}})(c,319677);const l=function(n,t,x){return G(this,null,function*(){const e=u;var i=this,m=globalThis.$[e(340)](),C=!0;let k=(D,j)=>{const f=e,g=Math[f(361)](D/j*100);console[f(319)](f(377),D,"total",j),console[f(319)](f(372),g+"%")},a=x||{};if(this[e(382)][e(327)]){if(typeof t===e(375)){const o=t[e(367)](e(365))>-1?t:t+e(365);a[e(360)]=o}else a=t||{},!a[e(360)]&&(a.name=e(362)+Date[e(344)]()+e(365));let D=this[e(382)][0][e(333)],j=this[e(382)][0][e(348)];const f=a[e(343)]&&a[e(330)];var R=globalThis[e(363)].mm[e(323)](a[e(343)]||D),X=globalThis.hinnn.mm[e(323)](a[e(330)]||j),I=globalThis.$[e(338)]({backgroundColor:e(329)},a||{});const g=this[e(382)][0][e(335)],O=g!=null&&g!=""&&g!=e(376),Z=this[e(321)](0)==1||f?e(328):"landscape",z=O&&!f?g[e(332)]():[R,X];var w=new d.jsPDF({orientation:Z,unit:"pt",format:z}),q=yield this.getHtml(n,a);a&&(a[e(326)]&&(I[e(346)]=a.pixelRatio,I[e(368)]=a[e(326)]),a[e(379)]!=null&&(C=a[e(379)]),a[e(336)]!=null&&(k=a[e(336)])),globalThis.$(q)[e(355)]("width","")[e(355)](e(348),""),this[e(325)]();var y=this[e(342)]();this[e(331)](q,I),y[e(337)](q[0]),globalThis.$(q)[e(355)](e(324));let A=y[e(354)](e(381)).length;this[e(370)](y,function(){const o=e;try{y[o(354)](o(381))[o(345)](function(T,B){const s=o;globalThis[s(363)][s(322)][s(358)](function(E){const p=s;r.snapdom.toCanvas(B,I)[p(318)](function(v){const P=p;var H=v[P(366)]("2d");H[P(356)]=!1;var W=v.toDataURL("image/jpeg",I.quality||.92);w.addImage(W,P(320),0,0,R,X),T<A-1&&w.addPage(),k(T+1,A),E()})[p(350)](v=>{throw new Error(v.message)})}),T==A-1&&(globalThis.hinnn.queue[s(358)](function(E){const p=s;if(C)i.removeTempContainer(),w[p(349)](a[p(360)]);else{i[p(359)]();let v=a[p(373)]||"blob",P=w.output(v);m.resolve(P)}globalThis[p(363)].queue.clear()}),globalThis[s(363)][s(322)][s(380)]())})}catch(T){console[o(339)](o(357)),console[o(319)](T)}})}return m.promise()})};function u(n,t){const x=c();return u=function(e,i){return e=e-318,x[e]},u(n,t)}function c(){const n=["save","catch","1270116jXYvDl","10isvtQq","134FXOcys","find","css","imageSmoothingEnabled","toPdf 失败(可能您的图片资源无法正常加载): ","add","removeTempContainer","name","floor","sv-print-","hinnn","2913lJqTSb",".pdf","getContext","indexOf","scale","7ephwfs","loadAllImages","2436640DEXpzD","toPdf percent: ","type","4154787eMEquO","string","自定义","cur","11468BswBuP","isDownload","run",".hiprint-printPanel .hiprint-printPaper","printPanels","then","log","JPEG","getOrient","queue","toPt","position:fixed","createTempContainer","pixelRatio","length","portrait","#fff","paperHeight","svg2canvas","toLocaleLowerCase","width","565334qhgZZz","paperType","onProgress","html","extend","error","Deferred","183uXkDZV","getTempContainer","paperWidth","now","each","dpr","1480820qWimoZ","height"];return c=function(){return n},c()}function h(){var n=["2979GBpDqr","add toPdf Api","4575935rhWZqJ","918DcynHl","toPdf","1523658KGpjTG","defineProperty","1531140yqUKYr","46392ARDXSt","230qAbAyB","newPrintTemplate","5242002lfWGRM","2950684ipXaaP","5TaYwDD","0.3.0","add toPdf Api to PrintTemplate","176VhqARN"];return h=function(){return n},h()}(function(n,t){for(var x=b,e=n();;)try{var i=-parseInt(x(324))/1*(parseInt(x(316))/2)+-parseInt(x(329))/3+-parseInt(x(319))/4+-parseInt(x(320))/5*(-parseInt(x(318))/6)+-parseInt(x(326))/7+parseInt(x(315))/8*(-parseInt(x(327))/9)+-parseInt(x(314))/10*(-parseInt(x(323))/11);if(i===t)break;e.push(e.shift())}catch(m){e.push(e.shift())}})(h,490146);function b(n,t){var x=h();return b=function(e,i){e=e-314;var m=x[e];return m},b(n,t)}function _(n){var t=b;return{name:t(325),description:"add toPdf Api",hooks:[{hook:t(317),name:t(322),description:t(322),priority:1,run:({template:x,options:e})=>{var i=t;Object[i(330)](x,i(328),{value:l,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:t(321)}}return _});
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});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-pdf3",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "add pdf api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",