@sv-print/plugin-api-pdf3 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,12 +1,12 @@
1
- "use strict";var $=(n,a,e)=>new Promise((x,l)=>{var b=t=>{try{h(e.next(t))}catch(u){l(u)}},T=t=>{try{h(e.throw(t))}catch(u){l(u)}},h=t=>t.done?x(t.value):Promise.resolve(t.value).then(b,T);h((e=e.apply(n,a)).next())});const H=require("html-to-image"),W=require("jspdf");function B(n){if(n&&n.__esModule)return n;const a=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(a,e,x.get?x:{enumerable:!0,get:()=>n[e]})}}return a.default=n,Object.freeze(a)}const A=B(H);function N(){const n=["string",`mm;
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;
2
6
  }
3
7
  .hiprint-printTemplate .hiprint-printPanel-small {
4
8
  display:inline-block;
5
- padding: `,'<div class="hiprint-printTemplate"></div>',"image/jpeg","217311dwUuKq","onProgress","clone","log","toPdf percent: ","save","toLowerCase","css","Deferred","hiprint-printPaper","each","toCanvas","svg","promise","getHtml","505125TmzeWp","row","webp","toLocaleLowerCase",".pdf","layoutRowGap","\u81EA\u5B9A\u4E49","panelLayoutOptions","baseURI","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","toDataURL",`mm;
6
- }
7
- </style>`,"png","add","getOrient",`mm;"></div>
8
- </div>`,"imageSmoothingEnabled","html","4701KfnUJn","JPEG","toPt","1027902YSTdxD","mm -","22FBGRQd","blob","cur","layoutType","paperHeight","indexOf","removeTempContainer",`<div class="hiprint-printPanel">
9
- <div class="hiprint-printPaper" style="width:`,"addPage","hiprint-printPaper-small start-",".hiprint-printPaper","loadAllImages","paperWidth","svg2canvas","hinnn","append","total","333410YIUmtd","height","sv-print-","gif","ceil","resolve","run",'<div class="hiprint-printPanel-small"></div>',"position:fixed","getContext","mm ","landscape","error","5NHjLEg","portrait","find","catch","then","output","496qDgPXn","createTempContainer","IMG","includes","addImage","quality","now","name","jpg","280QkzMMz","http","extend","jpeg",".hiprint-printPanel .hiprint-printPaper","671168WLjhUz","16877rUNkCS","printPanels","queue","src","width","removeClass","layoutColumnGap","floor"];return N=function(){return n},N()}(function(n,a){const e=G,x=n();for(;[];)try{if(-parseInt(e(179))/1+parseInt(e(166))/2+parseInt(e(212))/3*(-parseInt(e(161))/4)+parseInt(e(247))/5*(parseInt(e(215))/6)+-parseInt(e(167))/7*(-parseInt(e(152))/8)+-parseInt(e(194))/9+parseInt(e(234))/10*(-parseInt(e(217))/11)===a)break;x.push(x.shift())}catch(l){x.push(x.shift())}})(N,206575);const E=function(n,a,e){return $(this,null,function*(){const x=G;var l=this,b=globalThis.$[x(187)](),T=!![];let h=(g,P)=>{const d=x,o=Math[d(174)](g/P*100);console[d(182)](d(219),g,d(233),P),console[d(182)](d(183),o+"%")},t=e||{};if(this.printPanels.length){if(typeof a===x(175)){const r=a.indexOf(x(198))>-1?a:a+x(198);t[x(159)]=r}else t=a||{},!t[x(159)]&&(t[x(159)]=x(236)+Date[x(158)]()+".pdf");let g=this.printPanels[0][x(171)],P=this[x(168)][0][x(235)];var u=globalThis[x(231)].mm.toPt(t.paperWidth||g),z=globalThis[x(231)].mm[x(214)](t[x(221)]||P),w=globalThis.$[x(163)]({filter:r=>{const i=x;return r.tagName!=i(154)||r.tagName==i(154)&&([i(160),i(164),i(206),i(237),"bmp",i(196),i(191)][i(155)](r.src.split(".").pop()[i(185)]())||r[i(170)]!=r[i(202)]||r.src[i(222)](i(162))>-1&&r.src!=r[i(202)]||r[i(170)][i(222)]("base64")>-1)},backgroundColor:"#fff"},t||{});const d=this[x(168)][0].paperType,o=this[x(168)][0][x(201)],L=o&&(o[x(199)]>0||o[x(173)]>0),S=d!=null&&d!=""&&d!=x(200);var I=new W.jsPDF({orientation:this[x(208)](0)==1?x(248):x(245),unit:"pt",format:S?d[x(197)]():[u,z]}),m=yield this[x(193)](n,t);t&&t.isDownload!=null&&(T=t.isDownload),t&&t[x(180)]!=null&&(h=t[x(180)]),globalThis.$(m).css(x(171),"")[x(186)](x(235),""),this[x(153)]();var y=this.getTempContainer();if(L&&t[x(229)]&&t[x(221)]){let r=Math.floor(t[x(229)]/(g+o.layoutRowGap/2)),i=Math.floor(t.paperHeight/(P+o[x(173)]/2));const v=r*i,f=m[x(249)](".hiprint-printPanel .hiprint-printPaper"),_=f.length,s=Math[x(238)](_/v);let c=globalThis.$(x(177));o[x(220)]==x(195)?c[x(232)](`<style>
9
+ padding: `,"cur","onProgress"];return N=function(){return n},N()}function y(n,e){const a=N();return y=function(x,o){return x=x-259,a[x]},y(n,e)}const H=function(n,e,a){return q(this,null,function*(){const x=y;var o=this,h=globalThis.$.Deferred(),w=!![];let b=(P,_)=>{const d=y,i=Math.floor(P/_*100);console.log(d(334),P,d(272),_),console[d(297)](d(292),i+"%")},t=a||{};if(this.printPanels[x(274)]){if(typeof e=="string"){const c=e[x(346)](x(294))>-1?e:e+x(294);t[x(283)]=c}else t=e||{},!t.name&&(t[x(283)]=x(277)+Date[x(338)]()+x(294));let P=this[x(343)][0].width,_=this[x(343)][0][x(302)];var m=globalThis[x(299)].mm[x(303)](t[x(285)]||P),A=globalThis.hinnn.mm[x(303)](t[x(314)]||_),u=globalThis.$.extend({},t||{});const d=this[x(343)][0][x(259)],i=this[x(343)][0][x(264)],O=i&&(i[x(290)]>0||i[x(281)]>0),z=d!=null&&d!=""&&d!=x(315);var C=new E.jsPDF({orientation:this[x(263)](0)==1?"portrait":"landscape",unit:"pt",format:z?d[x(291)]():[m,A]}),g=yield this[x(293)](n,t);t&&(t.pixelRatio&&(u[x(311)]=t[x(317)],u[x(336)]=t.pixelRatio),t[x(295)]!=null&&(w=t[x(295)]),t[x(335)]!=null&&(b=t[x(335)])),globalThis.$(g)[x(312)](x(276),"")[x(312)](x(302),""),this[x(325)]();var v=this[x(331)]();if(O&&t.paperWidth&&t.paperHeight){let c=Math.floor(t[x(285)]/(P+i.layoutRowGap/2)),f=Math[x(321)](t[x(314)]/(_+i[x(281)]/2));const T=c*f,s=g[x(342)](x(337)),I=s[x(274)],p=Math[x(339)](I/T);let l=globalThis.$('<div class="hiprint-printTemplate"></div>');i[x(282)]==x(323)?l.append(`<style>
10
10
  .hiprint-printPanel-small{
11
11
  box-sizing: border-box;
12
12
  border: 0px;
@@ -16,7 +16,11 @@
16
16
  padding: 0;
17
17
  }
18
18
  .hiprint-printTemplate .hiprint-printPaper{
19
- margin: -`+(Number(o[x(199)])||0)/2+x(216)+(Number(o[x(173)])||0)/2+x(176)+(Number(o[x(199)])||0)/2+x(244)+(Number(o.layoutColumnGap)||0)/2+x(205)):c[x(232)](`<style>
19
+ margin: -`+(Number(i[x(290)])||0)/2+x(329)+(Number(i.layoutColumnGap)||0)/2+`mm;
20
+ }
21
+ .hiprint-printTemplate .hiprint-printPanel-small {
22
+ display:inline-block;
23
+ padding: `+(Number(i.layoutRowGap)||0)/2+x(320)+(Number(i.layoutColumnGap)||0)/2+x(328)):l[x(316)](`<style>
20
24
  .hiprint-printPanel-small{
21
25
  box-sizing: border-box;
22
26
  border: 0px;
@@ -30,4 +34,4 @@
30
34
  flex-wrap: wrap;
31
35
  flex-direction: column;
32
36
  align-content: flex-start;
33
- margin: -`+(Number(o[x(199)])||0)/2+x(216)+(Number(o[x(173)])||0)/2+x(176)+(Number(o[x(199)])||0)/2+x(244)+(Number(o[x(173)])||0)/2+x(205));for(let p=0;p<s;p++){const j=globalThis.$(x(224)+t[x(229)]+"mm;height:"+t[x(221)]+x(209)),O=p*v,U=Math.min((p+1)*v,_);for(let C=O;C<U;C++){const q=f.eq(C)[x(181)]();q[x(172)](x(188)),q.addClass(x(226)+C);const R=globalThis.$(x(241));R.append(q),j.find(x(227))[x(232)](R)}c[x(232)](j)}this[x(230)](c,w),y[x(211)](c[0]),globalThis.$(c)[x(186)](x(242))}else this[x(230)](m,w),y[x(211)](m[0]),globalThis.$(m)[x(186)]("position:fixed");let k=y.find(x(165)).length;this[x(228)](m,function(){const r=x;try{y[r(249)](".hiprint-printPanel .hiprint-printPaper")[r(189)](function(i,v){const f=r;globalThis.hinnn[f(169)][f(207)](function(_){const s=f;A[s(190)](v,w)[s(251)](function(c){const p=s;var j=c[p(243)]("2d");j[p(210)]=![];var O=c[p(204)](p(178),w[p(157)]||.92);I[p(156)](O,p(213),0,0,u,z),i<k-1&&I[p(225)](),h(i+1,k),_()})[s(250)](c=>{throw new Error(c.message)})}),i==k-1&&(globalThis[f(231)].queue.add(function(_){const s=f;if(T)l[s(223)](),I[s(184)](t[s(159)]);else{l[s(223)]();let c=t.type||s(218),p=I[s(151)](c);b[s(239)](p)}globalThis[s(231)][s(169)].clear()}),globalThis.hinnn[f(169)][f(240)]())})}catch(i){console[r(246)](r(203)),console[r(182)](i)}})}return b[x(192)]()})};function G(n,a){const e=N();return G=function(x,l){return x=x-151,e[x]},G(n,a)}function D(){var n=["5901KchWZA","10ZGmwvo","3104580mbrHuz","1044784GSXpCG","2352swQRTp","200559RKXpcB","385016BwJDBh","10XMnmGk","add toPdf Api","5cDVaPw","0.3.0","3357657ujxRWf","defineProperty","11517473BxFqSG","add toPdf Api to PrintTemplate"];return D=function(){return n},D()}(function(n,a){for(var e=M,x=n();[];)try{var l=parseInt(e(217))/1+-parseInt(e(212))/2*(-parseInt(e(216))/3)+-parseInt(e(214))/4*(-parseInt(e(220))/5)+parseInt(e(213))/6+-parseInt(e(211))/7*(-parseInt(e(215))/8)+-parseInt(e(222))/9+parseInt(e(218))/10*(-parseInt(e(224))/11);if(l===a)break;x.push(x.shift())}catch(b){x.push(x.shift())}})(D,325633);function M(n,a){var e=D();return M=function(x,l){x=x-210;var b=e[x];return b},M(n,a)}function K(n){var a=M;return{name:a(219),description:a(219),hooks:[{hook:"newPrintTemplate",name:a(210),description:a(210),priority:1,run:({template:e,options:x})=>{var l=a;Object[l(223)](e,"toPdf",{value:E,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:a(221)}}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,74 +1,77 @@
1
- var L = (r, n, e) => new Promise((x, l) => {
2
- var h = (a) => {
1
+ var O = (n, e, a) => new Promise((x, o) => {
2
+ var h = (t) => {
3
3
  try {
4
- b(e.next(a));
4
+ b(a.next(t));
5
5
  } catch (m) {
6
- l(m);
6
+ o(m);
7
7
  }
8
- }, T = (a) => {
8
+ }, w = (t) => {
9
9
  try {
10
- b(e.throw(a));
10
+ b(a.throw(t));
11
11
  } catch (m) {
12
- l(m);
12
+ o(m);
13
13
  }
14
- }, b = (a) => a.done ? x(a.value) : Promise.resolve(a.value).then(h, T);
15
- b((e = e.apply(r, n)).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 * as B from "html-to-image";
18
- import { jsPDF as O } from "jspdf";
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();
21
+ for (; []; )
22
+ try {
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)
24
+ break;
25
+ x.push(x.shift());
26
+ } catch (o) {
27
+ x.push(x.shift());
28
+ }
29
+ })(N, 143229);
19
30
  function N() {
20
- const r = ["string", `mm;
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;
21
36
  }
22
37
  .hiprint-printTemplate .hiprint-printPanel-small {
23
38
  display:inline-block;
24
- padding: `, '<div class="hiprint-printTemplate"></div>', "image/jpeg", "217311dwUuKq", "onProgress", "clone", "log", "toPdf percent: ", "save", "toLowerCase", "css", "Deferred", "hiprint-printPaper", "each", "toCanvas", "svg", "promise", "getHtml", "505125TmzeWp", "row", "webp", "toLocaleLowerCase", ".pdf", "layoutRowGap", "\u81EA\u5B9A\u4E49", "panelLayoutOptions", "baseURI", "toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "toDataURL", `mm;
25
- }
26
- </style>`, "png", "add", "getOrient", `mm;"></div>
27
- </div>`, "imageSmoothingEnabled", "html", "4701KfnUJn", "JPEG", "toPt", "1027902YSTdxD", "mm -", "22FBGRQd", "blob", "cur", "layoutType", "paperHeight", "indexOf", "removeTempContainer", `<div class="hiprint-printPanel">
28
- <div class="hiprint-printPaper" style="width:`, "addPage", "hiprint-printPaper-small start-", ".hiprint-printPaper", "loadAllImages", "paperWidth", "svg2canvas", "hinnn", "append", "total", "333410YIUmtd", "height", "sv-print-", "gif", "ceil", "resolve", "run", '<div class="hiprint-printPanel-small"></div>', "position:fixed", "getContext", "mm ", "landscape", "error", "5NHjLEg", "portrait", "find", "catch", "then", "output", "496qDgPXn", "createTempContainer", "IMG", "includes", "addImage", "quality", "now", "name", "jpg", "280QkzMMz", "http", "extend", "jpeg", ".hiprint-printPanel .hiprint-printPaper", "671168WLjhUz", "16877rUNkCS", "printPanels", "queue", "src", "width", "removeClass", "layoutColumnGap", "floor"];
39
+ padding: `, "cur", "onProgress"];
29
40
  return N = function() {
30
- return r;
41
+ return n;
31
42
  }, N();
32
43
  }
33
- (function(r, n) {
34
- const e = D, x = r();
35
- for (; []; )
36
- try {
37
- if (-parseInt(e(179)) / 1 + parseInt(e(166)) / 2 + parseInt(e(212)) / 3 * (-parseInt(e(161)) / 4) + parseInt(e(247)) / 5 * (parseInt(e(215)) / 6) + -parseInt(e(167)) / 7 * (-parseInt(e(152)) / 8) + -parseInt(e(194)) / 9 + parseInt(e(234)) / 10 * (-parseInt(e(217)) / 11) === n)
38
- break;
39
- x.push(x.shift());
40
- } catch (l) {
41
- x.push(x.shift());
42
- }
43
- })(N, 206575);
44
- const S = function(r, n, e) {
45
- return L(this, null, function* () {
46
- const x = D;
47
- var l = this, h = globalThis.$[x(187)](), T = !![];
48
- let b = (g, P) => {
49
- const d = x, o = Math[d(174)](g / P * 100);
50
- console[d(182)](d(219), g, d(233), P), console[d(182)](d(183), o + "%");
51
- }, a = e || {};
52
- if (this.printPanels.length) {
53
- if (typeof n === x(175)) {
54
- const i = n.indexOf(x(198)) > -1 ? n : n + x(198);
55
- a[x(159)] = i;
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;
56
62
  } else
57
- a = n || {}, !a[x(159)] && (a[x(159)] = x(236) + Date[x(158)]() + ".pdf");
58
- let g = this.printPanels[0][x(171)], P = this[x(168)][0][x(235)];
59
- var m = globalThis[x(231)].mm.toPt(a.paperWidth || g), q = globalThis[x(231)].mm[x(214)](a[x(221)] || P), I = globalThis.$[x(163)]({ filter: (i) => {
60
- const t = x;
61
- return i.tagName != t(154) || i.tagName == t(154) && ([t(160), t(164), t(206), t(237), "bmp", t(196), t(191)][t(155)](i.src.split(".").pop()[t(185)]()) || i[t(170)] != i[t(202)] || i.src[t(222)](t(162)) > -1 && i.src != i[t(202)] || i[t(170)][t(222)]("base64") > -1);
62
- }, backgroundColor: "#fff" }, a || {});
63
- const d = this[x(168)][0].paperType, o = this[x(168)][0][x(201)], U = o && (o[x(199)] > 0 || o[x(173)] > 0), H = d != null && d != "" && d != x(200);
64
- var w = new O({ orientation: this[x(208)](0) == 1 ? x(248) : x(245), unit: "pt", format: H ? d[x(197)]() : [m, q] }), u = yield this[x(193)](r, a);
65
- a && a.isDownload != null && (T = a.isDownload), a && a[x(180)] != null && (b = a[x(180)]), globalThis.$(u).css(x(171), "")[x(186)](x(235), ""), this[x(153)]();
66
- var y = this.getTempContainer();
67
- if (U && a[x(229)] && a[x(221)]) {
68
- let i = Math.floor(a[x(229)] / (g + o.layoutRowGap / 2)), t = Math.floor(a.paperHeight / (P + o[x(173)] / 2));
69
- const v = i * t, f = u[x(249)](".hiprint-printPanel .hiprint-printPaper"), _ = f.length, p = Math[x(238)](_ / v);
70
- let c = globalThis.$(x(177));
71
- o[x(220)] == x(195) ? c[x(232)](`<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>
72
75
  .hiprint-printPanel-small{
73
76
  box-sizing: border-box;
74
77
  border: 0px;
@@ -78,7 +81,11 @@ const S = function(r, n, e) {
78
81
  padding: 0;
79
82
  }
80
83
  .hiprint-printTemplate .hiprint-printPaper{
81
- margin: -` + (Number(o[x(199)]) || 0) / 2 + x(216) + (Number(o[x(173)]) || 0) / 2 + x(176) + (Number(o[x(199)]) || 0) / 2 + x(244) + (Number(o.layoutColumnGap) || 0) / 2 + x(205)) : c[x(232)](`<style>
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>
82
89
  .hiprint-printPanel-small{
83
90
  box-sizing: border-box;
84
91
  border: 0px;
@@ -92,95 +99,90 @@ const S = function(r, n, e) {
92
99
  flex-wrap: wrap;
93
100
  flex-direction: column;
94
101
  align-content: flex-start;
95
- margin: -` + (Number(o[x(199)]) || 0) / 2 + x(216) + (Number(o[x(173)]) || 0) / 2 + x(176) + (Number(o[x(199)]) || 0) / 2 + x(244) + (Number(o[x(173)]) || 0) / 2 + x(205));
96
- for (let s = 0; s < p; s++) {
97
- const C = globalThis.$(x(224) + a[x(229)] + "mm;height:" + a[x(221)] + x(209)), R = s * v, W = Math.min((s + 1) * v, _);
98
- for (let G = R; G < W; G++) {
99
- const $ = f.eq(G)[x(181)]();
100
- $[x(172)](x(188)), $.addClass(x(226) + G);
101
- const z = globalThis.$(x(241));
102
- z.append($), C.find(x(227))[x(232)](z);
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);
103
110
  }
104
- c[x(232)](C);
111
+ l[x(316)](M);
105
112
  }
106
- this[x(230)](c, I), y[x(211)](c[0]), globalThis.$(c)[x(186)](x(242));
113
+ this[x(345)](l, u), v[x(341)](l[0]), globalThis.$(l)[x(312)](x(269));
107
114
  } else
108
- this[x(230)](u, I), y[x(211)](u[0]), globalThis.$(u)[x(186)]("position:fixed");
109
- let j = y.find(x(165)).length;
110
- this[x(228)](u, function() {
111
- const i = 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;
112
119
  try {
113
- y[i(249)](".hiprint-printPanel .hiprint-printPaper")[i(189)](function(t, v) {
114
- const f = i;
115
- globalThis.hinnn[f(169)][f(207)](function(_) {
116
- const p = f;
117
- B[p(190)](v, I)[p(251)](function(c) {
118
- const s = p;
119
- var C = c[s(243)]("2d");
120
- C[s(210)] = ![];
121
- var R = c[s(204)](s(178), I[s(157)] || 0.92);
122
- w[s(156)](R, s(213), 0, 0, m, q), t < j - 1 && w[s(225)](), b(t + 1, j), _();
123
- })[p(250)]((c) => {
124
- throw new Error(c.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)]);
125
133
  });
126
- }), t == j - 1 && (globalThis[f(231)].queue.add(function(_) {
127
- const p = f;
128
- if (T)
129
- l[p(223)](), w[p(184)](a[p(159)]);
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);
130
138
  else {
131
- l[p(223)]();
132
- let c = a.type || p(218), s = w[p(151)](c);
133
- h[p(239)](s);
139
+ o.removeTempContainer();
140
+ let l = t[s(332)] || s(330), r = C.output(l);
141
+ h[s(260)](r);
134
142
  }
135
- globalThis[p(231)][p(169)].clear();
136
- }), globalThis.hinnn[f(169)][f(240)]());
143
+ globalThis[s(299)][s(275)][s(324)]();
144
+ }), globalThis[p(299)][p(275)][p(326)]());
137
145
  });
138
- } catch (t) {
139
- console[i(246)](i(203)), console[i(182)](t);
146
+ } catch (f) {
147
+ console[c(273)](c(348)), console[c(297)](f);
140
148
  }
141
149
  });
142
150
  }
143
- return h[x(192)]();
151
+ return h.promise();
144
152
  });
145
153
  };
146
- function D(r, n) {
147
- const e = N();
148
- return D = function(x, l) {
149
- return x = x - 151, e[x];
150
- }, D(r, n);
151
- }
152
- function k() {
153
- var r = ["5901KchWZA", "10ZGmwvo", "3104580mbrHuz", "1044784GSXpCG", "2352swQRTp", "200559RKXpcB", "385016BwJDBh", "10XMnmGk", "add toPdf Api", "5cDVaPw", "0.3.0", "3357657ujxRWf", "defineProperty", "11517473BxFqSG", "add toPdf Api to PrintTemplate"];
154
- return k = function() {
155
- return r;
156
- }, k();
157
- }
158
- (function(r, n) {
159
- for (var e = M, x = r(); []; )
154
+ (function(n, e) {
155
+ for (var a = D, x = n(); []; )
160
156
  try {
161
- var l = parseInt(e(217)) / 1 + -parseInt(e(212)) / 2 * (-parseInt(e(216)) / 3) + -parseInt(e(214)) / 4 * (-parseInt(e(220)) / 5) + parseInt(e(213)) / 6 + -parseInt(e(211)) / 7 * (-parseInt(e(215)) / 8) + -parseInt(e(222)) / 9 + parseInt(e(218)) / 10 * (-parseInt(e(224)) / 11);
162
- if (l === n)
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)
163
159
  break;
164
160
  x.push(x.shift());
165
161
  } catch (h) {
166
162
  x.push(x.shift());
167
163
  }
168
- })(k, 325633);
169
- function M(r, n) {
170
- var e = k();
171
- return M = function(x, l) {
172
- x = x - 210;
173
- var h = e[x];
164
+ })(k, 773925);
165
+ function k() {
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"];
167
+ return k = function() {
168
+ return n;
169
+ }, k();
170
+ }
171
+ function D(n, e) {
172
+ var a = k();
173
+ return D = function(x, o) {
174
+ x = x - 166;
175
+ var h = a[x];
174
176
  return h;
175
- }, M(r, n);
177
+ }, D(n, e);
176
178
  }
177
- function K(r) {
178
- var n = M;
179
- return { name: n(219), description: n(219), hooks: [{ hook: "newPrintTemplate", name: n(210), description: n(210), priority: 1, run: ({ template: e, options: x }) => {
180
- var l = n;
181
- Object[l(223)](e, "toPdf", { value: S, enumerable: ![], writable: !![], configurable: !![] });
182
- } }], leastHiprintVersion: n(221) };
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) };
183
185
  }
184
186
  export {
185
- K as default
187
+ F as default
186
188
  };
package/dist/index.umd.js CHANGED
@@ -1,12 +1,12 @@
1
- (function(b,m){typeof exports=="object"&&typeof module!="undefined"?module.exports=m(require("html-to-image"),require("jspdf")):typeof define=="function"&&define.amd?define(["html-to-image","jspdf"],m):(b=typeof globalThis!="undefined"?globalThis:b||self,b.pluginApiPdf=m(b.htmlToImage,b.jspdf))})(this,function(b,m){"use strict";var A=(b,m,P)=>new Promise((O,g)=>{var q=c=>{try{u(P.next(c))}catch(y){g(y)}},v=c=>{try{u(P.throw(c))}catch(y){g(y)}},u=c=>c.done?O(c.value):Promise.resolve(c.value).then(q,v);u((P=P.apply(b,m)).next())});function P(n){if(n&&n.__esModule)return n;const a=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(a,e,x.get?x:{enumerable:!0,get:()=>n[e]})}}return a.default=n,Object.freeze(a)}const O=P(b);function g(){const n=["string",`mm;
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;
2
6
  }
3
7
  .hiprint-printTemplate .hiprint-printPanel-small {
4
8
  display:inline-block;
5
- padding: `,'<div class="hiprint-printTemplate"></div>',"image/jpeg","217311dwUuKq","onProgress","clone","log","toPdf percent: ","save","toLowerCase","css","Deferred","hiprint-printPaper","each","toCanvas","svg","promise","getHtml","505125TmzeWp","row","webp","toLocaleLowerCase",".pdf","layoutRowGap","\u81EA\u5B9A\u4E49","panelLayoutOptions","baseURI","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","toDataURL",`mm;
6
- }
7
- </style>`,"png","add","getOrient",`mm;"></div>
8
- </div>`,"imageSmoothingEnabled","html","4701KfnUJn","JPEG","toPt","1027902YSTdxD","mm -","22FBGRQd","blob","cur","layoutType","paperHeight","indexOf","removeTempContainer",`<div class="hiprint-printPanel">
9
- <div class="hiprint-printPaper" style="width:`,"addPage","hiprint-printPaper-small start-",".hiprint-printPaper","loadAllImages","paperWidth","svg2canvas","hinnn","append","total","333410YIUmtd","height","sv-print-","gif","ceil","resolve","run",'<div class="hiprint-printPanel-small"></div>',"position:fixed","getContext","mm ","landscape","error","5NHjLEg","portrait","find","catch","then","output","496qDgPXn","createTempContainer","IMG","includes","addImage","quality","now","name","jpg","280QkzMMz","http","extend","jpeg",".hiprint-printPanel .hiprint-printPaper","671168WLjhUz","16877rUNkCS","printPanels","queue","src","width","removeClass","layoutColumnGap","floor"];return g=function(){return n},g()}(function(n,a){const e=v,x=n();for(;[];)try{if(-parseInt(e(179))/1+parseInt(e(166))/2+parseInt(e(212))/3*(-parseInt(e(161))/4)+parseInt(e(247))/5*(parseInt(e(215))/6)+-parseInt(e(167))/7*(-parseInt(e(152))/8)+-parseInt(e(194))/9+parseInt(e(234))/10*(-parseInt(e(217))/11)===a)break;x.push(x.shift())}catch(f){x.push(x.shift())}})(g,206575);const q=function(n,a,e){return A(this,null,function*(){const x=v;var f=this,_=globalThis.$[x(187)](),L=!![];let S=(I,w)=>{const d=x,o=Math[d(174)](I/w*100);console[d(182)](d(219),I,d(233),w),console[d(182)](d(183),o+"%")},i=e||{};if(this.printPanels.length){if(typeof a===x(175)){const r=a.indexOf(x(198))>-1?a:a+x(198);i[x(159)]=r}else i=a||{},!i[x(159)]&&(i[x(159)]=x(236)+Date[x(158)]()+".pdf");let I=this.printPanels[0][x(171)],w=this[x(168)][0][x(235)];var U=globalThis[x(231)].mm.toPt(i.paperWidth||I),H=globalThis[x(231)].mm[x(214)](i[x(221)]||w),N=globalThis.$[x(163)]({filter:r=>{const t=x;return r.tagName!=t(154)||r.tagName==t(154)&&([t(160),t(164),t(206),t(237),"bmp",t(196),t(191)][t(155)](r.src.split(".").pop()[t(185)]())||r[t(170)]!=r[t(202)]||r.src[t(222)](t(162))>-1&&r.src!=r[t(202)]||r[t(170)][t(222)]("base64")>-1)},backgroundColor:"#fff"},i||{});const d=this[x(168)][0].paperType,o=this[x(168)][0][x(201)],B=o&&(o[x(199)]>0||o[x(173)]>0),E=d!=null&&d!=""&&d!=x(200);var G=new m.jsPDF({orientation:this[x(208)](0)==1?x(248):x(245),unit:"pt",format:E?d[x(197)]():[U,H]}),T=yield this[x(193)](n,i);i&&i.isDownload!=null&&(L=i.isDownload),i&&i[x(180)]!=null&&(S=i[x(180)]),globalThis.$(T).css(x(171),"")[x(186)](x(235),""),this[x(153)]();var D=this.getTempContainer();if(B&&i[x(229)]&&i[x(221)]){let r=Math.floor(i[x(229)]/(I+o.layoutRowGap/2)),t=Math.floor(i.paperHeight/(w+o[x(173)]/2));const j=r*t,h=T[x(249)](".hiprint-printPanel .hiprint-printPaper"),C=h.length,p=Math[x(238)](C/j);let l=globalThis.$(x(177));o[x(220)]==x(195)?l[x(232)](`<style>
9
+ padding: `,"cur","onProgress"];return f=function(){return n},f()}function b(n,a){const t=f();return b=function(x,l){return x=x-259,t[x]},b(n,a)}const N=function(n,a,t){return Q(this,null,function*(){const x=b;var l=this,P=globalThis.$.Deferred(),K=!![];let q=(w,C)=>{const h=b,i=Math.floor(w/C*100);console.log(h(334),w,h(272),C),console[h(297)](h(292),i+"%")},e=t||{};if(this.printPanels[x(274)]){if(typeof a=="string"){const d=a[x(346)](x(294))>-1?a:a+x(294);e[x(283)]=d}else e=a||{},!e.name&&(e[x(283)]=x(277)+Date[x(338)]()+x(294));let w=this[x(343)][0].width,C=this[x(343)][0][x(302)];var z=globalThis[x(299)].mm[x(303)](e[x(285)]||w),O=globalThis.hinnn.mm[x(303)](e[x(314)]||C),_=globalThis.$.extend({},e||{});const h=this[x(343)][0][x(259)],i=this[x(343)][0][x(264)],E=i&&(i[x(290)]>0||i[x(281)]>0),H=h!=null&&h!=""&&h!=x(315);var j=new m.jsPDF({orientation:this[x(263)](0)==1?"portrait":"landscape",unit:"pt",format:H?h[x(291)]():[z,O]}),y=yield this[x(293)](n,e);e&&(e.pixelRatio&&(_[x(311)]=e[x(317)],_[x(336)]=e.pixelRatio),e[x(295)]!=null&&(K=e[x(295)]),e[x(335)]!=null&&(q=e[x(335)])),globalThis.$(y)[x(312)](x(276),"")[x(312)](x(302),""),this[x(325)]();var I=this[x(331)]();if(E&&e.paperWidth&&e.paperHeight){let d=Math.floor(e[x(285)]/(w+i.layoutRowGap/2)),u=Math[x(321)](e[x(314)]/(C+i[x(281)]/2));const M=d*u,o=y[x(342)](x(337)),R=o[x(274)],p=Math[x(339)](R/M);let s=globalThis.$('<div class="hiprint-printTemplate"></div>');i[x(282)]==x(323)?s.append(`<style>
10
10
  .hiprint-printPanel-small{
11
11
  box-sizing: border-box;
12
12
  border: 0px;
@@ -16,7 +16,11 @@
16
16
  padding: 0;
17
17
  }
18
18
  .hiprint-printTemplate .hiprint-printPaper{
19
- margin: -`+(Number(o[x(199)])||0)/2+x(216)+(Number(o[x(173)])||0)/2+x(176)+(Number(o[x(199)])||0)/2+x(244)+(Number(o.layoutColumnGap)||0)/2+x(205)):l[x(232)](`<style>
19
+ margin: -`+(Number(i[x(290)])||0)/2+x(329)+(Number(i.layoutColumnGap)||0)/2+`mm;
20
+ }
21
+ .hiprint-printTemplate .hiprint-printPanel-small {
22
+ display:inline-block;
23
+ padding: `+(Number(i.layoutRowGap)||0)/2+x(320)+(Number(i.layoutColumnGap)||0)/2+x(328)):s[x(316)](`<style>
20
24
  .hiprint-printPanel-small{
21
25
  box-sizing: border-box;
22
26
  border: 0px;
@@ -30,4 +34,4 @@
30
34
  flex-wrap: wrap;
31
35
  flex-direction: column;
32
36
  align-content: flex-start;
33
- margin: -`+(Number(o[x(199)])||0)/2+x(216)+(Number(o[x(173)])||0)/2+x(176)+(Number(o[x(199)])||0)/2+x(244)+(Number(o[x(173)])||0)/2+x(205));for(let s=0;s<p;s++){const M=globalThis.$(x(224)+i[x(229)]+"mm;height:"+i[x(221)]+x(209)),R=s*j,K=Math.min((s+1)*j,C);for(let k=R;k<K;k++){const $=h.eq(k)[x(181)]();$[x(172)](x(188)),$.addClass(x(226)+k);const W=globalThis.$(x(241));W.append($),M.find(x(227))[x(232)](W)}l[x(232)](M)}this[x(230)](l,N),D[x(211)](l[0]),globalThis.$(l)[x(186)](x(242))}else this[x(230)](T,N),D[x(211)](T[0]),globalThis.$(T)[x(186)]("position:fixed");let z=D.find(x(165)).length;this[x(228)](T,function(){const r=x;try{D[r(249)](".hiprint-printPanel .hiprint-printPaper")[r(189)](function(t,j){const h=r;globalThis.hinnn[h(169)][h(207)](function(C){const p=h;O[p(190)](j,N)[p(251)](function(l){const s=p;var M=l[s(243)]("2d");M[s(210)]=![];var R=l[s(204)](s(178),N[s(157)]||.92);G[s(156)](R,s(213),0,0,U,H),t<z-1&&G[s(225)](),S(t+1,z),C()})[p(250)](l=>{throw new Error(l.message)})}),t==z-1&&(globalThis[h(231)].queue.add(function(C){const p=h;if(L)f[p(223)](),G[p(184)](i[p(159)]);else{f[p(223)]();let l=i.type||p(218),s=G[p(151)](l);_[p(239)](s)}globalThis[p(231)][p(169)].clear()}),globalThis.hinnn[h(169)][h(240)]())})}catch(t){console[r(246)](r(203)),console[r(182)](t)}})}return _[x(192)]()})};function v(n,a){const e=g();return v=function(x,f){return x=x-151,e[x]},v(n,a)}function u(){var n=["5901KchWZA","10ZGmwvo","3104580mbrHuz","1044784GSXpCG","2352swQRTp","200559RKXpcB","385016BwJDBh","10XMnmGk","add toPdf Api","5cDVaPw","0.3.0","3357657ujxRWf","defineProperty","11517473BxFqSG","add toPdf Api to PrintTemplate"];return u=function(){return n},u()}(function(n,a){for(var e=c,x=n();[];)try{var f=parseInt(e(217))/1+-parseInt(e(212))/2*(-parseInt(e(216))/3)+-parseInt(e(214))/4*(-parseInt(e(220))/5)+parseInt(e(213))/6+-parseInt(e(211))/7*(-parseInt(e(215))/8)+-parseInt(e(222))/9+parseInt(e(218))/10*(-parseInt(e(224))/11);if(f===a)break;x.push(x.shift())}catch(_){x.push(x.shift())}})(u,325633);function c(n,a){var e=u();return c=function(x,f){x=x-210;var _=e[x];return _},c(n,a)}function y(n){var a=c;return{name:a(219),description:a(219),hooks:[{hook:"newPrintTemplate",name:a(210),description:a(210),priority:1,run:({template:e,options:x})=>{var f=a;Object[f(223)](e,"toPdf",{value:q,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:a(221)}}return y});
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.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": "^3.0.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
  }