@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 CHANGED
@@ -1,4 +1,12 @@
1
- "use strict";var j=(n,a,e)=>new Promise((x,o)=>{var c=t=>{try{f(e.next(t))}catch(m){o(m)}},I=t=>{try{f(e.throw(t))}catch(m){o(m)}},f=t=>t.done?x(t.value):Promise.resolve(t.value).then(c,I);f((e=e.apply(n,a)).next())});const z=require("@zumer/snapdom"),A=require("jspdf");function T(n,a){const e=q();return T=function(x,o){return x=x-167,e[x]},T(n,a)}(function(n,a){const e=T,x=n();for(;[];)try{if(parseInt(e(215))/1+-parseInt(e(203))/2+-parseInt(e(240))/3*(parseInt(e(184))/4)+-parseInt(e(231))/5*(parseInt(e(247))/6)+-parseInt(e(222))/7*(-parseInt(e(242))/8)+parseInt(e(185))/9+parseInt(e(235))/10===a)break;x.push(x.shift())}catch(o){x.push(x.shift())}})(q,686546);const J=function(n,a,e){return j(this,null,function*(){const x=T;var o=this,c=globalThis.$.Deferred(),I=!![];let f=(P,v)=>{const b=T,i=Math[b(216)](P/v*100);console[b(230)](b(220),P,"total",v),console.log("toPdf percent: ",i+"%")},t=e||{};if(this[x(228)][x(238)]){if(typeof a=="string"){const l=a[x(183)](".pdf")>-1?a:a+".pdf";t[x(236)]=l}else t=a||{},!t[x(236)]&&(t.name="sv-print-"+Date[x(181)]()+x(187));let P=this[x(228)][0][x(179)],v=this[x(228)][0][x(173)];var m=globalThis.hinnn.mm[x(180)](t[x(233)]||P),O=globalThis[x(171)].mm[x(180)](t[x(207)]||v),u=globalThis.$[x(241)]({},t||{});const b=this.printPanels[0][x(208)],i=this.printPanels[0][x(218)],E=i&&(i[x(212)]>0||i.layoutColumnGap>0),H=b!=null&&b!=""&&b!=x(223);var w=new A.jsPDF({orientation:this.getOrient(0)==1?x(219):"landscape",unit:"pt",format:H?b[x(239)]():[m,O]}),g=yield this.getHtml(n,t);t&&(t[x(188)]&&(u[x(194)]=t.pixelRatio,u[x(205)]=t[x(188)]),t[x(237)]!=null&&(I=t[x(237)]),t[x(200)]!=null&&(f=t[x(200)])),globalThis.$(g)[x(244)](x(179),"").css(x(173),""),this[x(245)]();var C=this.getTempContainer();if(E&&t[x(233)]&&t.paperHeight){let l=Math[x(216)](t[x(233)]/(P+i.layoutRowGap/2)),h=Math.floor(t[x(207)]/(v+i[x(197)]/2));const _=l*h,d=g.find(".hiprint-printPanel .hiprint-printPaper"),y=d.length,s=Math.ceil(y/_);let p=globalThis.$(x(170));i[x(176)]==x(248)?p.append(`<style>
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(212)])||0)/2+x(177)+(Number(i[x(197)])||0)/2+x(227)+(Number(i[x(212)])||0)/2+x(226)+(Number(i.layoutColumnGap)||0)/2+`mm;
19
+ margin: -`+(Number(i[x(290)])||0)/2+x(329)+(Number(i.layoutColumnGap)||0)/2+`mm;
12
20
  }
13
- </style>`):p[x(191)](x(225)+(Number(i[x(212)])||0)/2+"mm -"+(Number(i[x(197)])||0)/2+x(227)+(Number(i.layoutRowGap)||0)/2+"mm "+(Number(i[x(197)])||0)/2+x(186));for(let r=0;r<s;r++){const N=globalThis.$(x(178)+t[x(233)]+x(224)+t.paperHeight+x(213)),D=r*_,Y=Math[x(196)]((r+1)*_,y);for(let R=D;R<Y;R++){const G=d.eq(R)[x(189)]();G.removeClass(x(246)),G[x(217)](x(214)+R);const V=globalThis.$('<div class="hiprint-printPanel-small"></div>');V[x(191)](G),N[x(202)](x(201)).append(V)}p[x(191)](N)}this[x(167)](p,u),C[x(211)](p[0]),globalThis.$(p)[x(244)](x(168))}else this[x(167)](g,u),C[x(211)](g[0]),globalThis.$(g)[x(244)](x(168));let k=C[x(202)](x(243))[x(238)];this[x(199)](g,function(){const l=x;try{C[l(202)](l(243)).each(function(h,_){const d=l;globalThis[d(171)][d(232)].add(function(y){const s=d;z.snapdom.toCanvas(_,u)[s(198)](function(p){const r=s;var N=p[r(234)]("2d");N[r(193)]=![];var D=p[r(182)](r(192),u.quality||.92);w[r(169)](D,r(195),0,0,m,O),h<k-1&&w[r(190)](),f(h+1,k),y()})[s(174)](p=>{throw new Error(p.message)})}),h==k-1&&(globalThis[d(171)].queue[d(206)](function(y){const s=d;if(I)o.removeTempContainer(),w[s(221)](t[s(236)]);else{o.removeTempContainer();let p=t[s(204)]||"blob",r=w[s(172)](p);c[s(229)](r)}globalThis[s(171)][s(232)].clear()}),globalThis.hinnn.queue.run())})}catch(h){console[l(209)](l(175)),console[l(230)](h)}})}return c[x(210)]()})};function q(){const n=["870396MNVKbV","type","scale","add","paperHeight","paperType","error","promise","html","layoutRowGap",`mm;"></div>
14
- </div>`,"hiprint-printPaper-small start-","817870sRwNtd","floor","addClass","panelLayoutOptions","portrait","cur","save","36393lfxVEX","\u81EA\u5B9A\u4E49","mm;height:",`<style>
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: -`,"mm ",`mm;
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 E = (n, a, e) => new Promise((x, o) => {
2
- var c = (t) => {
1
+ var O = (n, e, a) => new Promise((x, o) => {
2
+ var h = (t) => {
3
3
  try {
4
- f(e.next(t));
4
+ b(a.next(t));
5
5
  } catch (m) {
6
6
  o(m);
7
7
  }
8
- }, I = (t) => {
8
+ }, w = (t) => {
9
9
  try {
10
- f(e.throw(t));
10
+ b(a.throw(t));
11
11
  } catch (m) {
12
12
  o(m);
13
13
  }
14
- }, f = (t) => t.done ? x(t.value) : Promise.resolve(t.value).then(c, I);
15
- f((e = e.apply(n, a)).next());
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 A } from "@zumer/snapdom";
18
- import { jsPDF as J } from "jspdf";
19
- function T(n, a) {
20
- const e = M();
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(e(215)) / 1 + -parseInt(e(203)) / 2 + -parseInt(e(240)) / 3 * (parseInt(e(184)) / 4) + -parseInt(e(231)) / 5 * (parseInt(e(247)) / 6) + -parseInt(e(222)) / 7 * (-parseInt(e(242)) / 8) + parseInt(e(185)) / 9 + parseInt(e(235)) / 10 === a)
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
- })(M, 686546);
36
- const K = function(n, a, e) {
37
- return E(this, null, function* () {
38
- const x = T;
39
- var o = this, c = globalThis.$.Deferred(), I = !![];
40
- let f = (P, v) => {
41
- const b = T, i = Math[b(216)](P / v * 100);
42
- console[b(230)](b(220), P, "total", v), console.log("toPdf percent: ", i + "%");
43
- }, t = e || {};
44
- if (this[x(228)][x(238)]) {
45
- if (typeof a == "string") {
46
- const l = a[x(183)](".pdf") > -1 ? a : a + ".pdf";
47
- t[x(236)] = l;
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 = a || {}, !t[x(236)] && (t.name = "sv-print-" + Date[x(181)]() + x(187));
50
- let P = this[x(228)][0][x(179)], v = this[x(228)][0][x(173)];
51
- var m = globalThis.hinnn.mm[x(180)](t[x(233)] || P), O = globalThis[x(171)].mm[x(180)](t[x(207)] || v), u = globalThis.$[x(241)]({}, t || {});
52
- const b = this.printPanels[0][x(208)], i = this.printPanels[0][x(218)], H = i && (i[x(212)] > 0 || i.layoutColumnGap > 0), Y = b != null && b != "" && b != x(223);
53
- var w = new J({ orientation: this.getOrient(0) == 1 ? x(219) : "landscape", unit: "pt", format: Y ? b[x(239)]() : [m, O] }), g = yield this.getHtml(n, t);
54
- t && (t[x(188)] && (u[x(194)] = t.pixelRatio, u[x(205)] = t[x(188)]), t[x(237)] != null && (I = t[x(237)]), t[x(200)] != null && (f = t[x(200)])), globalThis.$(g)[x(244)](x(179), "").css(x(173), ""), this[x(245)]();
55
- var C = this.getTempContainer();
56
- if (H && t[x(233)] && t.paperHeight) {
57
- let l = Math[x(216)](t[x(233)] / (P + i.layoutRowGap / 2)), h = Math.floor(t[x(207)] / (v + i[x(197)] / 2));
58
- const _ = l * h, d = g.find(".hiprint-printPanel .hiprint-printPaper"), y = d.length, p = Math.ceil(y / _);
59
- let s = globalThis.$(x(170));
60
- i[x(176)] == x(248) ? s.append(`<style>
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(212)]) || 0) / 2 + x(177) + (Number(i[x(197)]) || 0) / 2 + x(227) + (Number(i[x(212)]) || 0) / 2 + x(226) + (Number(i.layoutColumnGap) || 0) / 2 + `mm;
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
- </style>`) : s[x(191)](x(225) + (Number(i[x(212)]) || 0) / 2 + "mm -" + (Number(i[x(197)]) || 0) / 2 + x(227) + (Number(i.layoutRowGap) || 0) / 2 + "mm " + (Number(i[x(197)]) || 0) / 2 + x(186));
73
- for (let r = 0; r < p; r++) {
74
- const N = globalThis.$(x(178) + t[x(233)] + x(224) + t.paperHeight + x(213)), D = r * _, j = Math[x(196)]((r + 1) * _, y);
75
- for (let R = D; R < j; R++) {
76
- const G = d.eq(R)[x(189)]();
77
- G.removeClass(x(246)), G[x(217)](x(214) + R);
78
- const V = globalThis.$('<div class="hiprint-printPanel-small"></div>');
79
- V[x(191)](G), N[x(202)](x(201)).append(V);
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
- s[x(191)](N);
111
+ l[x(316)](M);
82
112
  }
83
- this[x(167)](s, u), C[x(211)](s[0]), globalThis.$(s)[x(244)](x(168));
113
+ this[x(345)](l, u), v[x(341)](l[0]), globalThis.$(l)[x(312)](x(269));
84
114
  } else
85
- this[x(167)](g, u), C[x(211)](g[0]), globalThis.$(g)[x(244)](x(168));
86
- let q = C[x(202)](x(243))[x(238)];
87
- this[x(199)](g, function() {
88
- const l = x;
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
- C[l(202)](l(243)).each(function(h, _) {
91
- const d = l;
92
- globalThis[d(171)][d(232)].add(function(y) {
93
- const p = d;
94
- A.toCanvas(_, u)[p(198)](function(s) {
95
- const r = p;
96
- var N = s[r(234)]("2d");
97
- N[r(193)] = ![];
98
- var D = s[r(182)](r(192), u.quality || 0.92);
99
- w[r(169)](D, r(195), 0, 0, m, O), h < q - 1 && w[r(190)](), f(h + 1, q), y();
100
- })[p(174)]((s) => {
101
- throw new Error(s.message);
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
- }), h == q - 1 && (globalThis[d(171)].queue[d(206)](function(y) {
104
- const p = d;
105
- if (I)
106
- o.removeTempContainer(), w[p(221)](t[p(236)]);
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 s = t[p(204)] || "blob", r = w[p(172)](s);
110
- c[p(229)](r);
140
+ let l = t[s(332)] || s(330), r = C.output(l);
141
+ h[s(260)](r);
111
142
  }
112
- globalThis[p(171)][p(232)].clear();
113
- }), globalThis.hinnn.queue.run());
143
+ globalThis[s(299)][s(275)][s(324)]();
144
+ }), globalThis[p(299)][p(275)][p(326)]());
114
145
  });
115
- } catch (h) {
116
- console[l(209)](l(175)), console[l(230)](h);
146
+ } catch (f) {
147
+ console[c(273)](c(348)), console[c(297)](f);
117
148
  }
118
149
  });
119
150
  }
120
- return c[x(210)]();
151
+ return h.promise();
121
152
  });
122
153
  };
123
- function M() {
124
- const n = ["870396MNVKbV", "type", "scale", "add", "paperHeight", "paperType", "error", "promise", "html", "layoutRowGap", `mm;"></div>
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(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;
155
- if (o === a)
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 (c) {
161
+ } catch (h) {
159
162
  x.push(x.shift());
160
163
  }
161
- })(k, 444814);
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 = ["11800220KdCSqW", "add toPdf Api to PrintTemplate", "149712dcKDWM", "36112hbQYCs", "toPdf", "31846ymriPr", "23eWdTxC", "newPrintTemplate", "602uMlddO", "44490VKEqul", "1166520yrTloY", "add toPdf Api", "5859288JZXlPB", "215YCzUPc"];
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 X(n) {
177
- var a = $;
178
- return { name: a(496), description: a(496), hooks: [{ hook: a(492), name: a(486), description: a(486), priority: 1, run: ({ template: e, options: x }) => {
179
- var o = a;
180
- Object.defineProperty(e, o(489), { value: K, enumerable: ![], writable: !![], configurable: !![] });
181
- } }], leastHiprintVersion: "0.3.0" };
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
- X as default
187
+ F as default
185
188
  };
package/dist/index.umd.js CHANGED
@@ -1,4 +1,12 @@
1
- (function(c,b){typeof exports=="object"&&typeof module!="undefined"?module.exports=b(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],b):(c=typeof globalThis!="undefined"?globalThis:c||self,c.pluginApiPdf=b(c.snapdom,c.jspdf))})(this,function(c,b){"use strict";var H=(c,b,s)=>new Promise(($,u)=>{var g=a=>{try{T(s.next(a))}catch(t){u(t)}},P=a=>{try{T(s.throw(a))}catch(t){u(t)}},T=a=>a.done?$(a.value):Promise.resolve(a.value).then(g,P);T((s=s.apply(c,b)).next())});function s(a,t){const e=u();return s=function(x,l){return x=x-167,e[x]},s(a,t)}(function(a,t){const e=s,x=a();for(;[];)try{if(parseInt(e(215))/1+-parseInt(e(203))/2+-parseInt(e(240))/3*(parseInt(e(184))/4)+-parseInt(e(231))/5*(parseInt(e(247))/6)+-parseInt(e(222))/7*(-parseInt(e(242))/8)+parseInt(e(185))/9+parseInt(e(235))/10===t)break;x.push(x.shift())}catch(l){x.push(x.shift())}})(u,686546);const $=function(a,t,e){return H(this,null,function*(){const x=s;var l=this,v=globalThis.$.Deferred(),O=!![];let V=(I,w)=>{const h=s,i=Math[h(216)](I/w*100);console[h(230)](h(220),I,"total",w),console.log("toPdf percent: ",i+"%")},n=e||{};if(this[x(228)][x(238)]){if(typeof t=="string"){const d=t[x(183)](".pdf")>-1?t:t+".pdf";n[x(236)]=d}else n=t||{},!n[x(236)]&&(n.name="sv-print-"+Date[x(181)]()+x(187));let I=this[x(228)][0][x(179)],w=this[x(228)][0][x(173)];var z=globalThis.hinnn.mm[x(180)](n[x(233)]||I),A=globalThis[x(171)].mm[x(180)](n[x(207)]||w),_=globalThis.$[x(241)]({},n||{});const h=this.printPanels[0][x(208)],i=this.printPanels[0][x(218)],Y=i&&(i[x(212)]>0||i.layoutColumnGap>0),J=h!=null&&h!=""&&h!=x(223);var R=new b.jsPDF({orientation:this.getOrient(0)==1?x(219):"landscape",unit:"pt",format:J?h[x(239)]():[z,A]}),y=yield this.getHtml(a,n);n&&(n[x(188)]&&(_[x(194)]=n.pixelRatio,_[x(205)]=n[x(188)]),n[x(237)]!=null&&(O=n[x(237)]),n[x(200)]!=null&&(V=n[x(200)])),globalThis.$(y)[x(244)](x(179),"").css(x(173),""),this[x(245)]();var q=this.getTempContainer();if(Y&&n[x(233)]&&n.paperHeight){let d=Math[x(216)](n[x(233)]/(I+i.layoutRowGap/2)),m=Math.floor(n[x(207)]/(w+i[x(197)]/2));const C=d*m,f=y.find(".hiprint-printPanel .hiprint-printPaper"),N=f.length,o=Math.ceil(N/C);let p=globalThis.$(x(170));i[x(176)]==x(248)?p.append(`<style>
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(212)])||0)/2+x(177)+(Number(i[x(197)])||0)/2+x(227)+(Number(i[x(212)])||0)/2+x(226)+(Number(i.layoutColumnGap)||0)/2+`mm;
19
+ margin: -`+(Number(i[x(290)])||0)/2+x(329)+(Number(i.layoutColumnGap)||0)/2+`mm;
12
20
  }
13
- </style>`):p[x(191)](x(225)+(Number(i[x(212)])||0)/2+"mm -"+(Number(i[x(197)])||0)/2+x(227)+(Number(i.layoutRowGap)||0)/2+"mm "+(Number(i[x(197)])||0)/2+x(186));for(let r=0;r<o;r++){const j=globalThis.$(x(178)+n[x(233)]+x(224)+n.paperHeight+x(213)),D=r*C,K=Math[x(196)]((r+1)*C,N);for(let M=D;M<K;M++){const G=f.eq(M)[x(189)]();G.removeClass(x(246)),G[x(217)](x(214)+M);const E=globalThis.$('<div class="hiprint-printPanel-small"></div>');E[x(191)](G),j[x(202)](x(201)).append(E)}p[x(191)](j)}this[x(167)](p,_),q[x(211)](p[0]),globalThis.$(p)[x(244)](x(168))}else this[x(167)](y,_),q[x(211)](y[0]),globalThis.$(y)[x(244)](x(168));let k=q[x(202)](x(243))[x(238)];this[x(199)](y,function(){const d=x;try{q[d(202)](d(243)).each(function(m,C){const f=d;globalThis[f(171)][f(232)].add(function(N){const o=f;c.snapdom.toCanvas(C,_)[o(198)](function(p){const r=o;var j=p[r(234)]("2d");j[r(193)]=![];var D=p[r(182)](r(192),_.quality||.92);R[r(169)](D,r(195),0,0,z,A),m<k-1&&R[r(190)](),V(m+1,k),N()})[o(174)](p=>{throw new Error(p.message)})}),m==k-1&&(globalThis[f(171)].queue[f(206)](function(N){const o=f;if(O)l.removeTempContainer(),R[o(221)](n[o(236)]);else{l.removeTempContainer();let p=n[o(204)]||"blob",r=R[o(172)](p);v[o(229)](r)}globalThis[o(171)][o(232)].clear()}),globalThis.hinnn.queue.run())})}catch(m){console[d(209)](d(175)),console[d(230)](m)}})}return v[x(210)]()})};function u(){const a=["870396MNVKbV","type","scale","add","paperHeight","paperType","error","promise","html","layoutRowGap",`mm;"></div>
14
- </div>`,"hiprint-printPaper-small start-","817870sRwNtd","floor","addClass","panelLayoutOptions","portrait","cur","save","36393lfxVEX","\u81EA\u5B9A\u4E49","mm;height:",`<style>
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: -`,"mm ",`mm;
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});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-pdf3",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "add pdf api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",