@sv-print/plugin-api-pdf 0.1.2 → 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 CHANGED
@@ -1,4 +1,8 @@
1
- "use strict";var R=(n,i,e)=>new Promise((x,p)=>{var b=t=>{try{h(e.next(t))}catch(u){p(u)}},w=t=>{try{h(e.throw(t))}catch(u){p(u)}},h=t=>t.done?x(t.value):Promise.resolve(t.value).then(b,w);h((e=e.apply(n,i)).next())});const A=require("html-to-image"),V=require("jspdf");function U(n){if(n&&n.__esModule)return n;const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const x=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(i,e,x.get?x:{enumerable:!0,get:()=>n[e]})}}return i.default=n,Object.freeze(i)}const W=U(A);(function(n,i){const e=T,x=n();for(;[];)try{if(parseInt(e(440))/1+parseInt(e(503))/2+parseInt(e(458))/3+parseInt(e(421))/4*(-parseInt(e(472))/5)+-parseInt(e(445))/6+-parseInt(e(488))/7*(parseInt(e(416))/8)+parseInt(e(467))/9===i)break;x.push(x.shift())}catch(p){x.push(x.shift())}})(O,707552);function T(n,i){const e=O();return T=function(x,p){return x=x-415,e[x]},T(n,i)}const B=function(n,i,e){return R(this,null,function*(){const x=T;var p=this,b=globalThis.$.Deferred(),w=!![];let h=(g,P)=>{const f=T,s=Math[f(444)](g/P*100);console[f(453)](f(477),g,f(463),P),console[f(453)](f(451),s+"%")},t=e||{};if(this[x(494)][x(475)]){if(typeof i=="string"){const r=i[x(464)](".pdf")>-1?i:i+x(452);t[x(419)]=r}else t=i||{},!t[x(419)]&&(t.name=x(497)+Date[x(473)]()+x(452));let g=this[x(494)][0][x(493)],P=this[x(494)][0].height;var u=globalThis[x(460)].mm.toPt(t[x(417)]||g),D=globalThis[x(460)].mm[x(449)](t[x(491)]||P),y=globalThis.$[x(489)]({filter:r=>{const a=x;return r[a(434)]!="IMG"||r.tagName=="IMG"&&([a(430),a(448),a(426),"gif",a(465),a(485),a(422)].includes(r[a(481)][a(418)](".")[a(433)]()[a(415)]())||r[a(481)]!=r[a(428)]||r[a(481)][a(464)](a(446))>-1&&r[a(481)]!=r[a(428)]||r.src.indexOf("base64")>-1)},backgroundColor:x(457)},t||{});const f=this.printPanels[0][x(427)],s=this.printPanels[0].panelLayoutOptions,$=s&&(s[x(484)]>0||s[x(483)]>0),z=f!=null&&f!=""&&f!="\u81EA\u5B9A\u4E49";var I=new V.jsPDF({orientation:this[x(486)](0)==1?x(482):x(455),unit:"pt",format:z?f[x(478)]():[u,D]}),m=yield this[x(439)](n,t);t&&t[x(507)]!=null&&(w=t[x(507)]),t&&t[x(462)]!=null&&(h=t[x(462)]),globalThis.$(m)[x(469)]("width","").css(x(459),""),this[x(425)]();var C=this.getTempContainer();if($&&t[x(417)]&&t[x(491)]){let r=Math[x(444)](t[x(417)]/(g+s[x(484)]/2)),a=Math[x(444)](t[x(491)]/(P+s[x(483)]/2));const v=r*a,l=m[x(435)](x(499)),_=l[x(475)],o=Math[x(474)](_/v);let c=globalThis.$(x(431));s[x(438)]=="row"?c[x(447)](x(429)+(Number(s[x(484)])||0)/2+x(468)+(Number(s[x(483)])||0)/2+x(432)+(Number(s.layoutRowGap)||0)/2+x(437)+(Number(s.layoutColumnGap)||0)/2+x(504)):c[x(447)](`<style>
1
+ "use strict";var L=(i,e,a)=>new Promise((x,o)=>{var b=t=>{try{m(a.next(t))}catch(u){o(u)}},w=t=>{try{m(a.throw(t))}catch(u){o(u)}},m=t=>t.done?x(t.value):Promise.resolve(t.value).then(b,w);m((a=a.apply(i,e)).next())});const W=require("@zumer/snapdom"),B=require("jspdf");(function(i,e){const a=I,x=i();for(;[];)try{if(parseInt(a(189))/1+-parseInt(a(195))/2+-parseInt(a(151))/3*(parseInt(a(138))/4)+-parseInt(a(143))/5+-parseInt(a(184))/6*(parseInt(a(177))/7)+-parseInt(a(133))/8+-parseInt(a(201))/9*(-parseInt(a(196))/10)===e)break;x.push(x.shift())}catch(o){x.push(x.shift())}})(k,780489);const E=function(i,e,a){return L(this,null,function*(){const x=I;var o=this,b=globalThis.$.Deferred(),w=!![];let m=(_,P)=>{const d=I,r=Math[d(199)](_/P*100);console.log("cur",_,d(192),P),console[d(156)](d(187),r+"%")},t=a||{};if(this[x(171)][x(174)]){if(typeof e===x(172)){const c=e[x(125)](".pdf")>-1?e:e+x(179);t.name=c}else t=e||{},!t[x(182)]&&(t[x(182)]=x(193)+Date[x(131)]()+".pdf");let _=this[x(171)][0][x(141)],P=this[x(171)][0].height;var u=globalThis.hinnn.mm[x(162)](t[x(175)]||_),J=globalThis[x(140)].mm[x(162)](t[x(153)]||P),f=globalThis.$[x(197)]({},t||{});const d=this[x(171)][0][x(128)],r=this[x(171)][0][x(176)],O=r&&(r[x(132)]>0||r[x(129)]>0),R=d!=null&&d!=""&&d!=x(144);var C=new B.jsPDF({orientation:this[x(161)](0)==1?x(136):x(181),unit:"pt",format:R?d.toLocaleLowerCase():[u,J]}),g=yield this[x(164)](i,t);t&&(t.pixelRatio&&(f.dpr=t[x(198)],f.scale=t[x(198)]),t[x(134)]!=null&&(w=t[x(134)]),t[x(148)]!=null&&(m=t[x(148)])),globalThis.$(g)[x(137)](x(141),"")[x(137)](x(183),""),this[x(194)]();var v=this[x(155)]();if(O&&t[x(175)]&&t[x(153)]){let c=Math[x(199)](t.paperWidth/(_+r.layoutRowGap/2)),h=Math.floor(t[x(153)]/(P+r.layoutColumnGap/2));const T=c*h,l=g[x(139)](x(123)),y=l[x(174)],n=Math[x(120)](y/T);let s=globalThis.$(x(146));r[x(186)]==x(173)?s[x(168)](x(135)+(Number(r[x(132)])||0)/2+x(122)+(Number(r.layoutColumnGap)||0)/2+`mm;
2
+ }
3
+ .hiprint-printTemplate .hiprint-printPanel-small {
4
+ display:inline-block;
5
+ padding: `+(Number(r[x(132)])||0)/2+"mm "+(Number(r.layoutColumnGap)||0)/2+x(185)):s[x(168)](`<style>
2
6
  .hiprint-printPanel-small{
3
7
  box-sizing: border-box;
4
8
  border: 0px;
@@ -12,11 +16,15 @@
12
16
  flex-wrap: wrap;
13
17
  flex-direction: column;
14
18
  align-content: flex-start;
15
- margin: -`+(Number(s[x(484)])||0)/2+x(468)+(Number(s[x(483)])||0)/2+x(432)+(Number(s[x(484)])||0)/2+x(437)+(Number(s[x(483)])||0)/2+x(504));for(let d=0;d<o;d++){const j=globalThis.$(`<div class="hiprint-printPanel">
16
- <div class="hiprint-printPaper" style="width:`+t.paperWidth+x(420)+t[x(491)]+`mm;"></div>
17
- </div>`),L=d*v,S=Math[x(487)]((d+1)*v,_);for(let N=L;N<S;N++){const k=l.eq(N)[x(505)]();k.removeClass(x(461)),k[x(506)](x(502)+N);const H=globalThis.$('<div class="hiprint-printPanel-small"></div>');H[x(447)](k),j[x(435)](x(443))[x(447)](H)}c[x(447)](j)}this[x(501)](c,y),C[x(466)](c[0]),globalThis.$(c)[x(469)](x(442))}else this[x(501)](m,y),C[x(466)](m[0]),globalThis.$(m)[x(469)](x(442));let G=C.find(".hiprint-printPanel .hiprint-printPaper")[x(475)];this.loadAllImages(m,function(){const r=x;try{C[r(435)](r(499))[r(495)](function(a,v){const l=r;globalThis[l(460)][l(436)][l(498)](function(_){const o=l;W[o(454)](v,y)[o(479)](function(c){const d=o;var j=c[d(496)]("2d");j[d(500)]=![];var L=c[d(423)](d(480),y.quality||.92);I.addImage(L,"JPEG",0,0,u,D),a<G-1&&I.addPage(),h(a+1,G),_()})[o(471)](c=>{const d=o;throw new Error(c[d(456)])})}),a==G-1&&(globalThis[l(460)][l(436)][l(498)](function(_){const o=l;if(w)p[o(470)](),I[o(476)](t[o(419)]);else{p[o(470)]();let c=t[o(441)]||o(490),d=I[o(450)](c);b.resolve(d)}globalThis[o(460)][o(436)].clear()}),globalThis[l(460)].queue[l(424)]())})}catch(a){console[r(492)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "),console[r(453)](a)}})}return b.promise()})};function O(){const n=["message","#fff","4208619DTbSZP","height","hinnn","hiprint-printPaper","onProgress","total","indexOf","bmp","html","5310000eweoHW","mm -","css","removeTempContainer","catch","65gLxMHl","now","ceil","length","save","cur","toLocaleLowerCase","then","image/jpeg","src","portrait","layoutColumnGap","layoutRowGap","webp","getOrient","min","32221ozycqv","extend","blob","paperHeight","error","width","printPanels","each","getContext","sv-print-","add",".hiprint-printPanel .hiprint-printPaper","imageSmoothingEnabled","svg2canvas","hiprint-printPaper-small start-","263716JLHqhL",`mm;
19
+ margin: -`+(Number(r[x(132)])||0)/2+"mm -"+(Number(r[x(129)])||0)/2+x(204)+(Number(r[x(132)])||0)/2+x(157)+(Number(r.layoutColumnGap)||0)/2+x(185));for(let p=0;p<n;p++){const G=globalThis.$(x(152)+t.paperWidth+x(154)+t[x(153)]+x(118)),$=p*T,U=Math.min((p+1)*T,y);for(let N=$;N<U;N++){const q=l.eq(N)[x(150)]();q[x(127)](x(170)),q[x(158)](x(160)+N);const A=globalThis.$('<div class="hiprint-printPanel-small"></div>');A.append(q),G[x(139)](x(178)).append(A)}s.append(G)}this[x(169)](s,f),v[x(145)](s[0]),globalThis.$(s)[x(137)](x(200))}else this.svg2canvas(g,f),v[x(145)](g[0]),globalThis.$(g)[x(137)](x(200));let M=v[x(139)](x(123))[x(174)];this.loadAllImages(v,function(){const c=x;try{v[c(139)](c(123))[c(165)](function(h,T){const l=c;globalThis[l(140)][l(191)][l(119)](function(y){const n=l;W.snapdom[n(147)](T,f)[n(159)](function(s){const p=n;var G=s[p(180)]("2d");G[p(126)]=![];var $=s[p(142)]("image/jpeg",f.quality||.92);C[p(205)]($,"JPEG",0,0,u,J),h<M-1&&C[p(124)](),m(h+1,M),y()})[n(121)](s=>{const p=n;throw new Error(s[p(206)])})}),h==M-1&&(globalThis[l(140)][l(191)][l(119)](function(y){const n=l;if(w)o[n(202)](),C[n(130)](t[n(182)]);else{o[n(202)]();let s=t[n(167)]||"blob",p=C[n(149)](s);b[n(166)](p)}globalThis.hinnn[n(191)][n(203)]()}),globalThis[l(140)].queue.run())})}catch(h){console[c(163)](c(188)),console[c(156)](h)}})}return b[x(190)]()})};function I(i,e){const a=k();return I=function(x,o){return x=x-118,a[x]},I(i,e)}function k(){const i=["clone","6dMscGT",`<div class="hiprint-printPanel">
20
+ <div class="hiprint-printPaper" style="width:`,"paperHeight","mm;height:","getTempContainer","log","mm ","addClass","then","hiprint-printPaper-small start-","getOrient","toPt","error","getHtml","each","resolve","type","append","svg2canvas","hiprint-printPaper","printPanels","string","row","length","paperWidth","panelLayoutOptions","1023631wWoxaT",".hiprint-printPaper",".pdf","getContext","landscape","name","height","30WptyTU",`mm;
18
21
  }
19
- </style>`,"clone","addClass","isDownload","toLowerCase","1064OQuVRs","paperWidth","split","name","mm;height:","252012TUBfqm","svg","toDataURL","run","createTempContainer","png","paperType","baseURI",`<style>
22
+ </style>`,"layoutType","toPdf percent: ","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","1168448GPmBDt","promise","queue","total","sv-print-","createTempContainer","2647114kIxruS","1428210JcRIkc","extend","pixelRatio","floor","position:fixed","261MdYkZK","removeTempContainer","clear",`mm;
23
+ }
24
+ .hiprint-printTemplate .hiprint-printPanel-small {
25
+ display:inline-block;
26
+ padding: `,"addImage","message",`mm;"></div>
27
+ </div>`,"add","ceil","catch","mm -",".hiprint-printPanel .hiprint-printPaper","addPage","indexOf","imageSmoothingEnabled","removeClass","paperType","layoutColumnGap","save","now","layoutRowGap","303088jpjeEu","isDownload",`<style>
20
28
  .hiprint-printPanel-small{
21
29
  box-sizing: border-box;
22
30
  border: 0px;
@@ -26,8 +34,4 @@
26
34
  padding: 0;
27
35
  }
28
36
  .hiprint-printTemplate .hiprint-printPaper{
29
- margin: -`,"jpg",'<div class="hiprint-printTemplate"></div>',`mm;
30
- }
31
- .hiprint-printTemplate .hiprint-printPanel-small {
32
- display:inline-block;
33
- padding: `,"pop","tagName","find","queue","mm ","layoutType","getHtml","403090NSIRHY","type","position:fixed",".hiprint-printPaper","floor","2334186Csqjzd","http","append","jpeg","toPt","output","toPdf percent: ",".pdf","log","toCanvas","landscape"];return O=function(){return n},O()}(function(n,i){for(var e=q,x=n();[];)try{var p=parseInt(e(186))/1*(parseInt(e(181))/2)+parseInt(e(177))/3+parseInt(e(180))/4*(-parseInt(e(184))/5)+-parseInt(e(183))/6*(parseInt(e(187))/7)+-parseInt(e(176))/8*(-parseInt(e(174))/9)+-parseInt(e(182))/10+parseInt(e(179))/11;if(p===i)break;x.push(x.shift())}catch(b){x.push(x.shift())}})(M,137645);function q(n,i){var e=M();return q=function(x,p){x=x-172;var b=e[x];return b},q(n,i)}function M(){var n=["30969oTwVoo","add toPdf Api","8wHhBkC","559548rBzwwo","toPdf","3110712lnIVuv","4DFfgVw","82OKQCWw","89540jzfgLR","512610MGUCRx","1023220TKZNhr","defineProperty","1204Tvmeyj","14qGSnNa","newPrintTemplate","add toPdf Api to PrintTemplate","0.3.0"];return M=function(){return n},M()}function E(n){var i=q;return{name:"add toPdf Api",description:i(175),hooks:[{hook:i(188),name:"add toPdf Api to PrintTemplate",description:i(172),priority:1,run:({template:e,options:x})=>{var p=i;Object[p(185)](e,p(178),{value:B,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:i(173)}}module.exports=E;
37
+ margin: -`,"portrait","css","2985212aXroAw","find","hinnn","width","toDataURL","4722770jKjDwl","\u81EA\u5B9A\u4E49","html",'<div class="hiprint-printTemplate"></div>',"toCanvas","onProgress","output"];return k=function(){return i},k()}(function(i,e){for(var a=D,x=i();[];)try{var o=parseInt(a(285))/1*(-parseInt(a(271))/2)+-parseInt(a(278))/3*(-parseInt(a(274))/4)+parseInt(a(276))/5*(-parseInt(a(270))/6)+-parseInt(a(269))/7*(parseInt(a(281))/8)+parseInt(a(286))/9+-parseInt(a(282))/10+-parseInt(a(279))/11*(-parseInt(a(272))/12);if(o===e)break;x.push(x.shift())}catch(b){x.push(x.shift())}})(j,888198);function j(){var i=["defineProperty","add toPdf Api to PrintTemplate","2723IGOXJN","8021799kZgTqd","101689obIHjr","195666UJaNvt","530sNXPXd","29986056hlVKwJ","0.3.0","2852356gBcZAa","newPrintTemplate","30pJdmwU","toPdf","6DDlCVP","11vOMLVp","add toPdf Api","808UNSBJG","15436410LeGBkC"];return j=function(){return i},j()}function D(i,e){var a=j();return D=function(x,o){x=x-269;var b=a[x];return b},D(i,e)}function H(i){var e=D;return{name:"add toPdf Api",description:e(280),hooks:[{hook:e(275),name:e(284),description:e(284),priority:1,run:({template:a,options:x})=>{var o=e;Object[o(283)](a,o(277),{value:E,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(273)}}module.exports=H;
package/dist/index.mjs CHANGED
@@ -1,66 +1,61 @@
1
- var D = (o, n, e) => new Promise((x, p) => {
1
+ var O = (i, e, a) => new Promise((x, o) => {
2
2
  var b = (t) => {
3
3
  try {
4
- h(e.next(t));
5
- } catch (m) {
6
- p(m);
4
+ m(a.next(t));
5
+ } catch (u) {
6
+ o(u);
7
7
  }
8
8
  }, w = (t) => {
9
9
  try {
10
- h(e.throw(t));
11
- } catch (m) {
12
- p(m);
10
+ m(a.throw(t));
11
+ } catch (u) {
12
+ o(u);
13
13
  }
14
- }, h = (t) => t.done ? x(t.value) : Promise.resolve(t.value).then(b, w);
15
- h((e = e.apply(o, n)).next());
14
+ }, m = (t) => t.done ? x(t.value) : Promise.resolve(t.value).then(b, w);
15
+ m((a = a.apply(i, e)).next());
16
16
  });
17
- import * as V from "html-to-image";
18
- import { jsPDF as S } from "jspdf";
19
- (function(o, n) {
20
- const e = T, x = o();
17
+ import { snapdom as W } from "@zumer/snapdom";
18
+ import { jsPDF as B } from "jspdf";
19
+ (function(i, e) {
20
+ const a = I, x = i();
21
21
  for (; []; )
22
22
  try {
23
- if (parseInt(e(440)) / 1 + parseInt(e(503)) / 2 + parseInt(e(458)) / 3 + parseInt(e(421)) / 4 * (-parseInt(e(472)) / 5) + -parseInt(e(445)) / 6 + -parseInt(e(488)) / 7 * (parseInt(e(416)) / 8) + parseInt(e(467)) / 9 === n)
23
+ if (parseInt(a(189)) / 1 + -parseInt(a(195)) / 2 + -parseInt(a(151)) / 3 * (parseInt(a(138)) / 4) + -parseInt(a(143)) / 5 + -parseInt(a(184)) / 6 * (parseInt(a(177)) / 7) + -parseInt(a(133)) / 8 + -parseInt(a(201)) / 9 * (-parseInt(a(196)) / 10) === e)
24
24
  break;
25
25
  x.push(x.shift());
26
- } catch (p) {
26
+ } catch (o) {
27
27
  x.push(x.shift());
28
28
  }
29
- })(G, 707552);
30
- function T(o, n) {
31
- const e = G();
32
- return T = function(x, p) {
33
- return x = x - 415, e[x];
34
- }, T(o, n);
35
- }
36
- const U = function(o, n, e) {
37
- return D(this, null, function* () {
38
- const x = T;
39
- var p = this, b = globalThis.$.Deferred(), w = !![];
40
- let h = (g, v) => {
41
- const f = T, s = Math[f(444)](g / v * 100);
42
- console[f(453)](f(477), g, f(463), v), console[f(453)](f(451), s + "%");
43
- }, t = e || {};
44
- if (this[x(494)][x(475)]) {
45
- if (typeof n == "string") {
46
- const i = n[x(464)](".pdf") > -1 ? n : n + x(452);
47
- t[x(419)] = i;
29
+ })(k, 780489);
30
+ const E = function(i, e, a) {
31
+ return O(this, null, function* () {
32
+ const x = I;
33
+ var o = this, b = globalThis.$.Deferred(), w = !![];
34
+ let m = (_, P) => {
35
+ const d = I, r = Math[d(199)](_ / P * 100);
36
+ console.log("cur", _, d(192), P), console[d(156)](d(187), r + "%");
37
+ }, t = a || {};
38
+ if (this[x(171)][x(174)]) {
39
+ if (typeof e === x(172)) {
40
+ const c = e[x(125)](".pdf") > -1 ? e : e + x(179);
41
+ t.name = c;
48
42
  } else
49
- t = n || {}, !t[x(419)] && (t.name = x(497) + Date[x(473)]() + x(452));
50
- let g = this[x(494)][0][x(493)], v = this[x(494)][0].height;
51
- var m = globalThis[x(460)].mm.toPt(t[x(417)] || g), $ = globalThis[x(460)].mm[x(449)](t[x(491)] || v), I = globalThis.$[x(489)]({ filter: (i) => {
52
- const a = x;
53
- return i[a(434)] != "IMG" || i.tagName == "IMG" && ([a(430), a(448), a(426), "gif", a(465), a(485), a(422)].includes(i[a(481)][a(418)](".")[a(433)]()[a(415)]()) || i[a(481)] != i[a(428)] || i[a(481)][a(464)](a(446)) > -1 && i[a(481)] != i[a(428)] || i.src.indexOf("base64") > -1);
54
- }, backgroundColor: x(457) }, t || {});
55
- const f = this.printPanels[0][x(427)], s = this.printPanels[0].panelLayoutOptions, O = s && (s[x(484)] > 0 || s[x(483)] > 0), z = f != null && f != "" && f != "\u81EA\u5B9A\u4E49";
56
- var y = new S({ orientation: this[x(486)](0) == 1 ? x(482) : x(455), unit: "pt", format: z ? f[x(478)]() : [m, $] }), u = yield this[x(439)](o, t);
57
- t && t[x(507)] != null && (w = t[x(507)]), t && t[x(462)] != null && (h = t[x(462)]), globalThis.$(u)[x(469)]("width", "").css(x(459), ""), this[x(425)]();
58
- var C = this.getTempContainer();
59
- if (O && t[x(417)] && t[x(491)]) {
60
- let i = Math[x(444)](t[x(417)] / (g + s[x(484)] / 2)), a = Math[x(444)](t[x(491)] / (v + s[x(483)] / 2));
61
- const P = i * a, l = u[x(435)](x(499)), _ = l[x(475)], r = Math[x(474)](_ / P);
62
- let c = globalThis.$(x(431));
63
- s[x(438)] == "row" ? c[x(447)](x(429) + (Number(s[x(484)]) || 0) / 2 + x(468) + (Number(s[x(483)]) || 0) / 2 + x(432) + (Number(s.layoutRowGap) || 0) / 2 + x(437) + (Number(s.layoutColumnGap) || 0) / 2 + x(504)) : c[x(447)](`<style>
43
+ t = e || {}, !t[x(182)] && (t[x(182)] = x(193) + Date[x(131)]() + ".pdf");
44
+ let _ = this[x(171)][0][x(141)], P = this[x(171)][0].height;
45
+ var u = globalThis.hinnn.mm[x(162)](t[x(175)] || _), A = globalThis[x(140)].mm[x(162)](t[x(153)] || P), f = globalThis.$[x(197)]({}, t || {});
46
+ const d = this[x(171)][0][x(128)], r = this[x(171)][0][x(176)], R = r && (r[x(132)] > 0 || r[x(129)] > 0), q = d != null && d != "" && d != x(144);
47
+ var C = new B({ orientation: this[x(161)](0) == 1 ? x(136) : x(181), unit: "pt", format: q ? d.toLocaleLowerCase() : [u, A] }), g = yield this[x(164)](i, t);
48
+ t && (t.pixelRatio && (f.dpr = t[x(198)], f.scale = t[x(198)]), t[x(134)] != null && (w = t[x(134)]), t[x(148)] != null && (m = t[x(148)])), globalThis.$(g)[x(137)](x(141), "")[x(137)](x(183), ""), this[x(194)]();
49
+ var v = this[x(155)]();
50
+ if (R && t[x(175)] && t[x(153)]) {
51
+ let c = Math[x(199)](t.paperWidth / (_ + r.layoutRowGap / 2)), h = Math.floor(t[x(153)] / (P + r.layoutColumnGap / 2));
52
+ const T = c * h, l = g[x(139)](x(123)), y = l[x(174)], n = Math[x(120)](y / T);
53
+ let s = globalThis.$(x(146));
54
+ r[x(186)] == x(173) ? s[x(168)](x(135) + (Number(r[x(132)]) || 0) / 2 + x(122) + (Number(r.layoutColumnGap) || 0) / 2 + `mm;
55
+ }
56
+ .hiprint-printTemplate .hiprint-printPanel-small {
57
+ display:inline-block;
58
+ padding: ` + (Number(r[x(132)]) || 0) / 2 + "mm " + (Number(r.layoutColumnGap) || 0) / 2 + x(185)) : s[x(168)](`<style>
64
59
  .hiprint-printPanel-small{
65
60
  box-sizing: border-box;
66
61
  border: 0px;
@@ -74,64 +69,74 @@ const U = function(o, n, e) {
74
69
  flex-wrap: wrap;
75
70
  flex-direction: column;
76
71
  align-content: flex-start;
77
- margin: -` + (Number(s[x(484)]) || 0) / 2 + x(468) + (Number(s[x(483)]) || 0) / 2 + x(432) + (Number(s[x(484)]) || 0) / 2 + x(437) + (Number(s[x(483)]) || 0) / 2 + x(504));
78
- for (let d = 0; d < r; d++) {
79
- const N = globalThis.$(`<div class="hiprint-printPanel">
80
- <div class="hiprint-printPaper" style="width:` + t.paperWidth + x(420) + t[x(491)] + `mm;"></div>
81
- </div>`), H = d * P, A = Math[x(487)]((d + 1) * P, _);
82
- for (let q = H; q < A; q++) {
83
- const R = l.eq(q)[x(505)]();
84
- R.removeClass(x(461)), R[x(506)](x(502) + q);
85
- const k = globalThis.$('<div class="hiprint-printPanel-small"></div>');
86
- k[x(447)](R), N[x(435)](x(443))[x(447)](k);
72
+ margin: -` + (Number(r[x(132)]) || 0) / 2 + "mm -" + (Number(r[x(129)]) || 0) / 2 + x(204) + (Number(r[x(132)]) || 0) / 2 + x(157) + (Number(r.layoutColumnGap) || 0) / 2 + x(185));
73
+ for (let p = 0; p < n; p++) {
74
+ const G = globalThis.$(x(152) + t.paperWidth + x(154) + t[x(153)] + x(118)), $ = p * T, U = Math.min((p + 1) * T, y);
75
+ for (let N = $; N < U; N++) {
76
+ const J = l.eq(N)[x(150)]();
77
+ J[x(127)](x(170)), J[x(158)](x(160) + N);
78
+ const L = globalThis.$('<div class="hiprint-printPanel-small"></div>');
79
+ L.append(J), G[x(139)](x(178)).append(L);
87
80
  }
88
- c[x(447)](N);
81
+ s.append(G);
89
82
  }
90
- this[x(501)](c, I), C[x(466)](c[0]), globalThis.$(c)[x(469)](x(442));
83
+ this[x(169)](s, f), v[x(145)](s[0]), globalThis.$(s)[x(137)](x(200));
91
84
  } else
92
- this[x(501)](u, I), C[x(466)](u[0]), globalThis.$(u)[x(469)](x(442));
93
- let j = C.find(".hiprint-printPanel .hiprint-printPaper")[x(475)];
94
- this.loadAllImages(u, function() {
95
- const i = x;
85
+ this.svg2canvas(g, f), v[x(145)](g[0]), globalThis.$(g)[x(137)](x(200));
86
+ let M = v[x(139)](x(123))[x(174)];
87
+ this.loadAllImages(v, function() {
88
+ const c = x;
96
89
  try {
97
- C[i(435)](i(499))[i(495)](function(a, P) {
98
- const l = i;
99
- globalThis[l(460)][l(436)][l(498)](function(_) {
100
- const r = l;
101
- V[r(454)](P, I)[r(479)](function(c) {
102
- const d = r;
103
- var N = c[d(496)]("2d");
104
- N[d(500)] = ![];
105
- var H = c[d(423)](d(480), I.quality || 0.92);
106
- y.addImage(H, "JPEG", 0, 0, m, $), a < j - 1 && y.addPage(), h(a + 1, j), _();
107
- })[r(471)]((c) => {
108
- const d = r;
109
- throw new Error(c[d(456)]);
90
+ v[c(139)](c(123))[c(165)](function(h, T) {
91
+ const l = c;
92
+ globalThis[l(140)][l(191)][l(119)](function(y) {
93
+ const n = l;
94
+ W[n(147)](T, f)[n(159)](function(s) {
95
+ const p = n;
96
+ var G = s[p(180)]("2d");
97
+ G[p(126)] = ![];
98
+ var $ = s[p(142)]("image/jpeg", f.quality || 0.92);
99
+ C[p(205)]($, "JPEG", 0, 0, u, A), h < M - 1 && C[p(124)](), m(h + 1, M), y();
100
+ })[n(121)]((s) => {
101
+ const p = n;
102
+ throw new Error(s[p(206)]);
110
103
  });
111
- }), a == j - 1 && (globalThis[l(460)][l(436)][l(498)](function(_) {
112
- const r = l;
104
+ }), h == M - 1 && (globalThis[l(140)][l(191)][l(119)](function(y) {
105
+ const n = l;
113
106
  if (w)
114
- p[r(470)](), y[r(476)](t[r(419)]);
107
+ o[n(202)](), C[n(130)](t[n(182)]);
115
108
  else {
116
- p[r(470)]();
117
- let c = t[r(441)] || r(490), d = y[r(450)](c);
118
- b.resolve(d);
109
+ o[n(202)]();
110
+ let s = t[n(167)] || "blob", p = C[n(149)](s);
111
+ b[n(166)](p);
119
112
  }
120
- globalThis[r(460)][r(436)].clear();
121
- }), globalThis[l(460)].queue[l(424)]());
113
+ globalThis.hinnn[n(191)][n(203)]();
114
+ }), globalThis[l(140)].queue.run());
122
115
  });
123
- } catch (a) {
124
- console[i(492)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "), console[i(453)](a);
116
+ } catch (h) {
117
+ console[c(163)](c(188)), console[c(156)](h);
125
118
  }
126
119
  });
127
120
  }
128
- return b.promise();
121
+ return b[x(190)]();
129
122
  });
130
123
  };
131
- function G() {
132
- const o = ["message", "#fff", "4208619DTbSZP", "height", "hinnn", "hiprint-printPaper", "onProgress", "total", "indexOf", "bmp", "html", "5310000eweoHW", "mm -", "css", "removeTempContainer", "catch", "65gLxMHl", "now", "ceil", "length", "save", "cur", "toLocaleLowerCase", "then", "image/jpeg", "src", "portrait", "layoutColumnGap", "layoutRowGap", "webp", "getOrient", "min", "32221ozycqv", "extend", "blob", "paperHeight", "error", "width", "printPanels", "each", "getContext", "sv-print-", "add", ".hiprint-printPanel .hiprint-printPaper", "imageSmoothingEnabled", "svg2canvas", "hiprint-printPaper-small start-", "263716JLHqhL", `mm;
124
+ function I(i, e) {
125
+ const a = k();
126
+ return I = function(x, o) {
127
+ return x = x - 118, a[x];
128
+ }, I(i, e);
129
+ }
130
+ function k() {
131
+ const i = ["clone", "6dMscGT", `<div class="hiprint-printPanel">
132
+ <div class="hiprint-printPaper" style="width:`, "paperHeight", "mm;height:", "getTempContainer", "log", "mm ", "addClass", "then", "hiprint-printPaper-small start-", "getOrient", "toPt", "error", "getHtml", "each", "resolve", "type", "append", "svg2canvas", "hiprint-printPaper", "printPanels", "string", "row", "length", "paperWidth", "panelLayoutOptions", "1023631wWoxaT", ".hiprint-printPaper", ".pdf", "getContext", "landscape", "name", "height", "30WptyTU", `mm;
133
+ }
134
+ </style>`, "layoutType", "toPdf percent: ", "toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "1168448GPmBDt", "promise", "queue", "total", "sv-print-", "createTempContainer", "2647114kIxruS", "1428210JcRIkc", "extend", "pixelRatio", "floor", "position:fixed", "261MdYkZK", "removeTempContainer", "clear", `mm;
133
135
  }
134
- </style>`, "clone", "addClass", "isDownload", "toLowerCase", "1064OQuVRs", "paperWidth", "split", "name", "mm;height:", "252012TUBfqm", "svg", "toDataURL", "run", "createTempContainer", "png", "paperType", "baseURI", `<style>
136
+ .hiprint-printTemplate .hiprint-printPanel-small {
137
+ display:inline-block;
138
+ padding: `, "addImage", "message", `mm;"></div>
139
+ </div>`, "add", "ceil", "catch", "mm -", ".hiprint-printPanel .hiprint-printPaper", "addPage", "indexOf", "imageSmoothingEnabled", "removeClass", "paperType", "layoutColumnGap", "save", "now", "layoutRowGap", "303088jpjeEu", "isDownload", `<style>
135
140
  .hiprint-printPanel-small{
136
141
  box-sizing: border-box;
137
142
  border: 0px;
@@ -141,47 +146,43 @@ function G() {
141
146
  padding: 0;
142
147
  }
143
148
  .hiprint-printTemplate .hiprint-printPaper{
144
- margin: -`, "jpg", '<div class="hiprint-printTemplate"></div>', `mm;
145
- }
146
- .hiprint-printTemplate .hiprint-printPanel-small {
147
- display:inline-block;
148
- padding: `, "pop", "tagName", "find", "queue", "mm ", "layoutType", "getHtml", "403090NSIRHY", "type", "position:fixed", ".hiprint-printPaper", "floor", "2334186Csqjzd", "http", "append", "jpeg", "toPt", "output", "toPdf percent: ", ".pdf", "log", "toCanvas", "landscape"];
149
- return G = function() {
150
- return o;
151
- }, G();
149
+ margin: -`, "portrait", "css", "2985212aXroAw", "find", "hinnn", "width", "toDataURL", "4722770jKjDwl", "\u81EA\u5B9A\u4E49", "html", '<div class="hiprint-printTemplate"></div>', "toCanvas", "onProgress", "output"];
150
+ return k = function() {
151
+ return i;
152
+ }, k();
152
153
  }
153
- (function(o, n) {
154
- for (var e = L, x = o(); []; )
154
+ (function(i, e) {
155
+ for (var a = j, x = i(); []; )
155
156
  try {
156
- var p = parseInt(e(186)) / 1 * (parseInt(e(181)) / 2) + parseInt(e(177)) / 3 + parseInt(e(180)) / 4 * (-parseInt(e(184)) / 5) + -parseInt(e(183)) / 6 * (parseInt(e(187)) / 7) + -parseInt(e(176)) / 8 * (-parseInt(e(174)) / 9) + -parseInt(e(182)) / 10 + parseInt(e(179)) / 11;
157
- if (p === n)
157
+ var o = parseInt(a(285)) / 1 * (-parseInt(a(271)) / 2) + -parseInt(a(278)) / 3 * (-parseInt(a(274)) / 4) + parseInt(a(276)) / 5 * (-parseInt(a(270)) / 6) + -parseInt(a(269)) / 7 * (parseInt(a(281)) / 8) + parseInt(a(286)) / 9 + -parseInt(a(282)) / 10 + -parseInt(a(279)) / 11 * (-parseInt(a(272)) / 12);
158
+ if (o === e)
158
159
  break;
159
160
  x.push(x.shift());
160
161
  } catch (b) {
161
162
  x.push(x.shift());
162
163
  }
163
- })(M, 137645);
164
- function L(o, n) {
165
- var e = M();
166
- return L = function(x, p) {
167
- x = x - 172;
168
- var b = e[x];
169
- return b;
170
- }, L(o, n);
164
+ })(D, 888198);
165
+ function D() {
166
+ var i = ["defineProperty", "add toPdf Api to PrintTemplate", "2723IGOXJN", "8021799kZgTqd", "101689obIHjr", "195666UJaNvt", "530sNXPXd", "29986056hlVKwJ", "0.3.0", "2852356gBcZAa", "newPrintTemplate", "30pJdmwU", "toPdf", "6DDlCVP", "11vOMLVp", "add toPdf Api", "808UNSBJG", "15436410LeGBkC"];
167
+ return D = function() {
168
+ return i;
169
+ }, D();
171
170
  }
172
- function M() {
173
- var o = ["30969oTwVoo", "add toPdf Api", "8wHhBkC", "559548rBzwwo", "toPdf", "3110712lnIVuv", "4DFfgVw", "82OKQCWw", "89540jzfgLR", "512610MGUCRx", "1023220TKZNhr", "defineProperty", "1204Tvmeyj", "14qGSnNa", "newPrintTemplate", "add toPdf Api to PrintTemplate", "0.3.0"];
174
- return M = function() {
175
- return o;
176
- }, M();
171
+ function j(i, e) {
172
+ var a = D();
173
+ return j = function(x, o) {
174
+ x = x - 269;
175
+ var b = a[x];
176
+ return b;
177
+ }, j(i, e);
177
178
  }
178
- function E(o) {
179
- var n = L;
180
- return { name: "add toPdf Api", description: n(175), hooks: [{ hook: n(188), name: "add toPdf Api to PrintTemplate", description: n(172), priority: 1, run: ({ template: e, options: x }) => {
181
- var p = n;
182
- Object[p(185)](e, p(178), { value: U, enumerable: ![], writable: !![], configurable: !![] });
183
- } }], leastHiprintVersion: n(173) };
179
+ function K(i) {
180
+ var e = j;
181
+ return { name: "add toPdf Api", description: e(280), hooks: [{ hook: e(275), name: e(284), description: e(284), priority: 1, run: ({ template: a, options: x }) => {
182
+ var o = e;
183
+ Object[o(283)](a, o(277), { value: E, enumerable: ![], writable: !![], configurable: !![] });
184
+ } }], leastHiprintVersion: e(273) };
184
185
  }
185
186
  export {
186
- E as default
187
+ K as default
187
188
  };
package/dist/index.umd.js CHANGED
@@ -1,4 +1,8 @@
1
- (function(h,g){typeof exports=="object"&&typeof module!="undefined"?module.exports=g(require("html-to-image"),require("jspdf")):typeof define=="function"&&define.amd?define(["html-to-image","jspdf"],g):(h=typeof globalThis!="undefined"?globalThis:h||self,h.pluginApiPdf=g(h.htmlToImage,h.jspdf))})(this,function(h,g){"use strict";var U=(h,g,P)=>new Promise((L,u)=>{var k=d=>{try{m(P.next(d))}catch(y){u(y)}},v=d=>{try{m(P.throw(d))}catch(y){u(y)}},m=d=>d.done?L(d.value):Promise.resolve(d.value).then(k,v);m((P=P.apply(h,g)).next())});function P(a){if(a&&a.__esModule)return a;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const x=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(n,e,x.get?x:{enumerable:!0,get:()=>a[e]})}}return n.default=a,Object.freeze(n)}const L=P(h);(function(a,n){const e=u,x=a();for(;[];)try{if(parseInt(e(440))/1+parseInt(e(503))/2+parseInt(e(458))/3+parseInt(e(421))/4*(-parseInt(e(472))/5)+-parseInt(e(445))/6+-parseInt(e(488))/7*(parseInt(e(416))/8)+parseInt(e(467))/9===n)break;x.push(x.shift())}catch(f){x.push(x.shift())}})(v,707552);function u(a,n){const e=v();return u=function(x,f){return x=x-415,e[x]},u(a,n)}const k=function(a,n,e){return U(this,null,function*(){const x=u;var f=this,_=globalThis.$.Deferred(),$=!![];let z=(w,I)=>{const b=u,s=Math[b(444)](w/I*100);console[b(453)](b(477),w,b(463),I),console[b(453)](b(451),s+"%")},i=e||{};if(this[x(494)][x(475)]){if(typeof n=="string"){const r=n[x(464)](".pdf")>-1?n:n+x(452);i[x(419)]=r}else i=n||{},!i[x(419)]&&(i.name=x(497)+Date[x(473)]()+x(452));let w=this[x(494)][0][x(493)],I=this[x(494)][0].height;var A=globalThis[x(460)].mm.toPt(i[x(417)]||w),S=globalThis[x(460)].mm[x(449)](i[x(491)]||I),N=globalThis.$[x(489)]({filter:r=>{const t=x;return r[t(434)]!="IMG"||r.tagName=="IMG"&&([t(430),t(448),t(426),"gif",t(465),t(485),t(422)].includes(r[t(481)][t(418)](".")[t(433)]()[t(415)]())||r[t(481)]!=r[t(428)]||r[t(481)][t(464)](t(446))>-1&&r[t(481)]!=r[t(428)]||r.src.indexOf("base64")>-1)},backgroundColor:x(457)},i||{});const b=this.printPanels[0][x(427)],s=this.printPanels[0].panelLayoutOptions,W=s&&(s[x(484)]>0||s[x(483)]>0),B=b!=null&&b!=""&&b!="\u81EA\u5B9A\u4E49";var O=new g.jsPDF({orientation:this[x(486)](0)==1?x(482):x(455),unit:"pt",format:B?b[x(478)]():[A,S]}),T=yield this[x(439)](a,i);i&&i[x(507)]!=null&&($=i[x(507)]),i&&i[x(462)]!=null&&(z=i[x(462)]),globalThis.$(T)[x(469)]("width","").css(x(459),""),this[x(425)]();var q=this.getTempContainer();if(W&&i[x(417)]&&i[x(491)]){let r=Math[x(444)](i[x(417)]/(w+s[x(484)]/2)),t=Math[x(444)](i[x(491)]/(I+s[x(483)]/2));const j=r*t,p=T[x(435)](x(499)),C=p[x(475)],o=Math[x(474)](C/j);let l=globalThis.$(x(431));s[x(438)]=="row"?l[x(447)](x(429)+(Number(s[x(484)])||0)/2+x(468)+(Number(s[x(483)])||0)/2+x(432)+(Number(s.layoutRowGap)||0)/2+x(437)+(Number(s.layoutColumnGap)||0)/2+x(504)):l[x(447)](`<style>
1
+ (function(d,h){typeof exports=="object"&&typeof module!="undefined"?module.exports=h(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],h):(d=typeof globalThis!="undefined"?globalThis:d||self,d.pluginApiPdf=h(d.window,d.jspdf))})(this,function(d,h){"use strict";var W=(d,h,g)=>new Promise((m,u)=>{var v=n=>{try{y(g.next(n))}catch(e){u(e)}},P=n=>{try{y(g.throw(n))}catch(e){u(e)}},y=n=>n.done?m(n.value):Promise.resolve(n.value).then(v,P);y((g=g.apply(d,h)).next())});(function(n,e){const a=m,x=n();for(;[];)try{if(parseInt(a(189))/1+-parseInt(a(195))/2+-parseInt(a(151))/3*(parseInt(a(138))/4)+-parseInt(a(143))/5+-parseInt(a(184))/6*(parseInt(a(177))/7)+-parseInt(a(133))/8+-parseInt(a(201))/9*(-parseInt(a(196))/10)===e)break;x.push(x.shift())}catch(l){x.push(x.shift())}})(u,780489);const g=function(n,e,a){return W(this,null,function*(){const x=m;var l=this,_=globalThis.$.Deferred(),J=!![];let L=(C,G)=>{const b=m,r=Math[b(199)](C/G*100);console.log("cur",C,b(192),G),console[b(156)](b(187),r+"%")},t=a||{};if(this[x(171)][x(174)]){if(typeof e===x(172)){const c=e[x(125)](".pdf")>-1?e:e+x(179);t.name=c}else t=e||{},!t[x(182)]&&(t[x(182)]=x(193)+Date[x(131)]()+".pdf");let C=this[x(171)][0][x(141)],G=this[x(171)][0].height;var O=globalThis.hinnn.mm[x(162)](t[x(175)]||C),R=globalThis[x(140)].mm[x(162)](t[x(153)]||G),T=globalThis.$[x(197)]({},t||{});const b=this[x(171)][0][x(128)],r=this[x(171)][0][x(176)],z=r&&(r[x(132)]>0||r[x(129)]>0),B=b!=null&&b!=""&&b!=x(144);var k=new h.jsPDF({orientation:this[x(161)](0)==1?x(136):x(181),unit:"pt",format:B?b.toLocaleLowerCase():[O,R]}),I=yield this[x(164)](n,t);t&&(t.pixelRatio&&(T.dpr=t[x(198)],T.scale=t[x(198)]),t[x(134)]!=null&&(J=t[x(134)]),t[x(148)]!=null&&(L=t[x(148)])),globalThis.$(I)[x(137)](x(141),"")[x(137)](x(183),""),this[x(194)]();var w=this[x(155)]();if(z&&t[x(175)]&&t[x(153)]){let c=Math[x(199)](t.paperWidth/(C+r.layoutRowGap/2)),f=Math.floor(t[x(153)]/(G+r.layoutColumnGap/2));const j=c*f,s=I[x(139)](x(123)),N=s[x(174)],i=Math[x(120)](N/j);let p=globalThis.$(x(146));r[x(186)]==x(173)?p[x(168)](x(135)+(Number(r[x(132)])||0)/2+x(122)+(Number(r.layoutColumnGap)||0)/2+`mm;
2
+ }
3
+ .hiprint-printTemplate .hiprint-printPanel-small {
4
+ display:inline-block;
5
+ padding: `+(Number(r[x(132)])||0)/2+"mm "+(Number(r.layoutColumnGap)||0)/2+x(185)):p[x(168)](`<style>
2
6
  .hiprint-printPanel-small{
3
7
  box-sizing: border-box;
4
8
  border: 0px;
@@ -12,11 +16,15 @@
12
16
  flex-wrap: wrap;
13
17
  flex-direction: column;
14
18
  align-content: flex-start;
15
- margin: -`+(Number(s[x(484)])||0)/2+x(468)+(Number(s[x(483)])||0)/2+x(432)+(Number(s[x(484)])||0)/2+x(437)+(Number(s[x(483)])||0)/2+x(504));for(let c=0;c<o;c++){const M=globalThis.$(`<div class="hiprint-printPanel">
16
- <div class="hiprint-printPaper" style="width:`+i.paperWidth+x(420)+i[x(491)]+`mm;"></div>
17
- </div>`),H=c*j,E=Math[x(487)]((c+1)*j,C);for(let G=H;G<E;G++){const R=p.eq(G)[x(505)]();R.removeClass(x(461)),R[x(506)](x(502)+G);const V=globalThis.$('<div class="hiprint-printPanel-small"></div>');V[x(447)](R),M[x(435)](x(443))[x(447)](V)}l[x(447)](M)}this[x(501)](l,N),q[x(466)](l[0]),globalThis.$(l)[x(469)](x(442))}else this[x(501)](T,N),q[x(466)](T[0]),globalThis.$(T)[x(469)](x(442));let D=q.find(".hiprint-printPanel .hiprint-printPaper")[x(475)];this.loadAllImages(T,function(){const r=x;try{q[r(435)](r(499))[r(495)](function(t,j){const p=r;globalThis[p(460)][p(436)][p(498)](function(C){const o=p;L[o(454)](j,N)[o(479)](function(l){const c=o;var M=l[c(496)]("2d");M[c(500)]=![];var H=l[c(423)](c(480),N.quality||.92);O.addImage(H,"JPEG",0,0,A,S),t<D-1&&O.addPage(),z(t+1,D),C()})[o(471)](l=>{const c=o;throw new Error(l[c(456)])})}),t==D-1&&(globalThis[p(460)][p(436)][p(498)](function(C){const o=p;if($)f[o(470)](),O[o(476)](i[o(419)]);else{f[o(470)]();let l=i[o(441)]||o(490),c=O[o(450)](l);_.resolve(c)}globalThis[o(460)][o(436)].clear()}),globalThis[p(460)].queue[p(424)]())})}catch(t){console[r(492)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "),console[r(453)](t)}})}return _.promise()})};function v(){const a=["message","#fff","4208619DTbSZP","height","hinnn","hiprint-printPaper","onProgress","total","indexOf","bmp","html","5310000eweoHW","mm -","css","removeTempContainer","catch","65gLxMHl","now","ceil","length","save","cur","toLocaleLowerCase","then","image/jpeg","src","portrait","layoutColumnGap","layoutRowGap","webp","getOrient","min","32221ozycqv","extend","blob","paperHeight","error","width","printPanels","each","getContext","sv-print-","add",".hiprint-printPanel .hiprint-printPaper","imageSmoothingEnabled","svg2canvas","hiprint-printPaper-small start-","263716JLHqhL",`mm;
19
+ margin: -`+(Number(r[x(132)])||0)/2+"mm -"+(Number(r[x(129)])||0)/2+x(204)+(Number(r[x(132)])||0)/2+x(157)+(Number(r.layoutColumnGap)||0)/2+x(185));for(let o=0;o<i;o++){const D=globalThis.$(x(152)+t.paperWidth+x(154)+t[x(153)]+x(118)),q=o*j,E=Math.min((o+1)*j,N);for(let M=q;M<E;M++){const A=s.eq(M)[x(150)]();A[x(127)](x(170)),A[x(158)](x(160)+M);const U=globalThis.$('<div class="hiprint-printPanel-small"></div>');U.append(A),D[x(139)](x(178)).append(U)}p.append(D)}this[x(169)](p,T),w[x(145)](p[0]),globalThis.$(p)[x(137)](x(200))}else this.svg2canvas(I,T),w[x(145)](I[0]),globalThis.$(I)[x(137)](x(200));let $=w[x(139)](x(123))[x(174)];this.loadAllImages(w,function(){const c=x;try{w[c(139)](c(123))[c(165)](function(f,j){const s=c;globalThis[s(140)][s(191)][s(119)](function(N){const i=s;d.snapdom[i(147)](j,T)[i(159)](function(p){const o=i;var D=p[o(180)]("2d");D[o(126)]=![];var q=p[o(142)]("image/jpeg",T.quality||.92);k[o(205)](q,"JPEG",0,0,O,R),f<$-1&&k[o(124)](),L(f+1,$),N()})[i(121)](p=>{const o=i;throw new Error(p[o(206)])})}),f==$-1&&(globalThis[s(140)][s(191)][s(119)](function(N){const i=s;if(J)l[i(202)](),k[i(130)](t[i(182)]);else{l[i(202)]();let p=t[i(167)]||"blob",o=k[i(149)](p);_[i(166)](o)}globalThis.hinnn[i(191)][i(203)]()}),globalThis[s(140)].queue.run())})}catch(f){console[c(163)](c(188)),console[c(156)](f)}})}return _[x(190)]()})};function m(n,e){const a=u();return m=function(x,l){return x=x-118,a[x]},m(n,e)}function u(){const n=["clone","6dMscGT",`<div class="hiprint-printPanel">
20
+ <div class="hiprint-printPaper" style="width:`,"paperHeight","mm;height:","getTempContainer","log","mm ","addClass","then","hiprint-printPaper-small start-","getOrient","toPt","error","getHtml","each","resolve","type","append","svg2canvas","hiprint-printPaper","printPanels","string","row","length","paperWidth","panelLayoutOptions","1023631wWoxaT",".hiprint-printPaper",".pdf","getContext","landscape","name","height","30WptyTU",`mm;
18
21
  }
19
- </style>`,"clone","addClass","isDownload","toLowerCase","1064OQuVRs","paperWidth","split","name","mm;height:","252012TUBfqm","svg","toDataURL","run","createTempContainer","png","paperType","baseURI",`<style>
22
+ </style>`,"layoutType","toPdf percent: ","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","1168448GPmBDt","promise","queue","total","sv-print-","createTempContainer","2647114kIxruS","1428210JcRIkc","extend","pixelRatio","floor","position:fixed","261MdYkZK","removeTempContainer","clear",`mm;
23
+ }
24
+ .hiprint-printTemplate .hiprint-printPanel-small {
25
+ display:inline-block;
26
+ padding: `,"addImage","message",`mm;"></div>
27
+ </div>`,"add","ceil","catch","mm -",".hiprint-printPanel .hiprint-printPaper","addPage","indexOf","imageSmoothingEnabled","removeClass","paperType","layoutColumnGap","save","now","layoutRowGap","303088jpjeEu","isDownload",`<style>
20
28
  .hiprint-printPanel-small{
21
29
  box-sizing: border-box;
22
30
  border: 0px;
@@ -26,8 +34,4 @@
26
34
  padding: 0;
27
35
  }
28
36
  .hiprint-printTemplate .hiprint-printPaper{
29
- margin: -`,"jpg",'<div class="hiprint-printTemplate"></div>',`mm;
30
- }
31
- .hiprint-printTemplate .hiprint-printPanel-small {
32
- display:inline-block;
33
- padding: `,"pop","tagName","find","queue","mm ","layoutType","getHtml","403090NSIRHY","type","position:fixed",".hiprint-printPaper","floor","2334186Csqjzd","http","append","jpeg","toPt","output","toPdf percent: ",".pdf","log","toCanvas","landscape"];return v=function(){return a},v()}(function(a,n){for(var e=m,x=a();[];)try{var f=parseInt(e(186))/1*(parseInt(e(181))/2)+parseInt(e(177))/3+parseInt(e(180))/4*(-parseInt(e(184))/5)+-parseInt(e(183))/6*(parseInt(e(187))/7)+-parseInt(e(176))/8*(-parseInt(e(174))/9)+-parseInt(e(182))/10+parseInt(e(179))/11;if(f===n)break;x.push(x.shift())}catch(_){x.push(x.shift())}})(d,137645);function m(a,n){var e=d();return m=function(x,f){x=x-172;var _=e[x];return _},m(a,n)}function d(){var a=["30969oTwVoo","add toPdf Api","8wHhBkC","559548rBzwwo","toPdf","3110712lnIVuv","4DFfgVw","82OKQCWw","89540jzfgLR","512610MGUCRx","1023220TKZNhr","defineProperty","1204Tvmeyj","14qGSnNa","newPrintTemplate","add toPdf Api to PrintTemplate","0.3.0"];return d=function(){return a},d()}function y(a){var n=m;return{name:"add toPdf Api",description:n(175),hooks:[{hook:n(188),name:"add toPdf Api to PrintTemplate",description:n(172),priority:1,run:({template:e,options:x})=>{var f=n;Object[f(185)](e,f(178),{value:k,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:n(173)}}return y});
37
+ margin: -`,"portrait","css","2985212aXroAw","find","hinnn","width","toDataURL","4722770jKjDwl","\u81EA\u5B9A\u4E49","html",'<div class="hiprint-printTemplate"></div>',"toCanvas","onProgress","output"];return u=function(){return n},u()}(function(n,e){for(var a=P,x=n();[];)try{var l=parseInt(a(285))/1*(-parseInt(a(271))/2)+-parseInt(a(278))/3*(-parseInt(a(274))/4)+parseInt(a(276))/5*(-parseInt(a(270))/6)+-parseInt(a(269))/7*(parseInt(a(281))/8)+parseInt(a(286))/9+-parseInt(a(282))/10+-parseInt(a(279))/11*(-parseInt(a(272))/12);if(l===e)break;x.push(x.shift())}catch(_){x.push(x.shift())}})(v,888198);function v(){var n=["defineProperty","add toPdf Api to PrintTemplate","2723IGOXJN","8021799kZgTqd","101689obIHjr","195666UJaNvt","530sNXPXd","29986056hlVKwJ","0.3.0","2852356gBcZAa","newPrintTemplate","30pJdmwU","toPdf","6DDlCVP","11vOMLVp","add toPdf Api","808UNSBJG","15436410LeGBkC"];return v=function(){return n},v()}function P(n,e){var a=v();return P=function(x,l){x=x-269;var _=a[x];return _},P(n,e)}function y(n){var e=P;return{name:"add toPdf Api",description:e(280),hooks:[{hook:e(275),name:e(284),description:e(284),priority:1,run:({template:a,options:x})=>{var l=e;Object[l(283)](a,l(277),{value:g,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(273)}}return y});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-pdf",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "add pdf api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,13 +34,13 @@
34
34
  "dependencies": {
35
35
  "sv-print": "^0.2.0",
36
36
  "jspdf": "^2.5.2",
37
- "html-to-image": "^1.11.13"
37
+ "@zumer/snapdom": "^2.0.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "vite-plugin-javascript-obfuscator": "^3.1.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "sv-print": "^0.2.0",
44
- "html-to-image": "^1.11.13"
44
+ "@zumer/snapdom": "^2.0.1"
45
45
  }
46
46
  }