@sv-print/plugin-api-pdf3 0.1.2 → 0.2.0

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,4 @@
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;
2
- }
3
- .hiprint-printTemplate .hiprint-printPanel-small {
4
- 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>
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>
10
2
  .hiprint-printPanel-small{
11
3
  box-sizing: border-box;
12
4
  border: 0px;
@@ -16,7 +8,10 @@
16
8
  padding: 0;
17
9
  }
18
10
  .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>
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;
12
+ }
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>
20
15
  .hiprint-printPanel-small{
21
16
  box-sizing: border-box;
22
17
  border: 0px;
@@ -30,4 +25,11 @@
30
25
  flex-wrap: wrap;
31
26
  flex-direction: column;
32
27
  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;
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;
package/dist/index.mjs CHANGED
@@ -1,74 +1,63 @@
1
- var L = (r, n, e) => new Promise((x, l) => {
2
- var h = (a) => {
1
+ var E = (n, a, e) => new Promise((x, o) => {
2
+ var c = (t) => {
3
3
  try {
4
- b(e.next(a));
4
+ f(e.next(t));
5
5
  } catch (m) {
6
- l(m);
6
+ o(m);
7
7
  }
8
- }, T = (a) => {
8
+ }, I = (t) => {
9
9
  try {
10
- b(e.throw(a));
10
+ f(e.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
+ }, f = (t) => t.done ? x(t.value) : Promise.resolve(t.value).then(c, I);
15
+ f((e = e.apply(n, a)).next());
16
16
  });
17
- import * as B from "html-to-image";
18
- import { jsPDF as O } from "jspdf";
19
- function N() {
20
- const r = ["string", `mm;
21
- }
22
- .hiprint-printTemplate .hiprint-printPanel-small {
23
- 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"];
29
- return N = function() {
30
- return r;
31
- }, N();
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);
32
24
  }
33
- (function(r, n) {
34
- const e = D, x = r();
25
+ (function(n, a) {
26
+ const e = T, x = n();
35
27
  for (; []; )
36
28
  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)
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)
38
30
  break;
39
31
  x.push(x.shift());
40
- } catch (l) {
32
+ } catch (o) {
41
33
  x.push(x.shift());
42
34
  }
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;
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;
56
48
  } 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>
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>
72
61
  .hiprint-printPanel-small{
73
62
  box-sizing: border-box;
74
63
  border: 0px;
@@ -78,109 +67,119 @@ const S = function(r, n, e) {
78
67
  padding: 0;
79
68
  }
80
69
  .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>
82
- .hiprint-printPanel-small{
83
- box-sizing: border-box;
84
- border: 0px;
85
- }
86
- .hiprint-printPaper-small{
87
- position: relative;
88
- padding: 0;
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;
89
71
  }
90
- .hiprint-printTemplate .hiprint-printPaper{
91
- display: flex;
92
- flex-wrap: wrap;
93
- flex-direction: column;
94
- 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);
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);
103
80
  }
104
- c[x(232)](C);
81
+ s[x(191)](N);
105
82
  }
106
- this[x(230)](c, I), y[x(211)](c[0]), globalThis.$(c)[x(186)](x(242));
83
+ this[x(167)](s, u), C[x(211)](s[0]), globalThis.$(s)[x(244)](x(168));
107
84
  } 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;
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;
112
89
  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);
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);
125
102
  });
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)]);
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)]);
130
107
  else {
131
- l[p(223)]();
132
- let c = a.type || p(218), s = w[p(151)](c);
133
- h[p(239)](s);
108
+ o.removeTempContainer();
109
+ let s = t[p(204)] || "blob", r = w[p(172)](s);
110
+ c[p(229)](r);
134
111
  }
135
- globalThis[p(231)][p(169)].clear();
136
- }), globalThis.hinnn[f(169)][f(240)]());
112
+ globalThis[p(171)][p(232)].clear();
113
+ }), globalThis.hinnn.queue.run());
137
114
  });
138
- } catch (t) {
139
- console[i(246)](i(203)), console[i(182)](t);
115
+ } catch (h) {
116
+ console[l(209)](l(175)), console[l(230)](h);
140
117
  }
141
118
  });
142
119
  }
143
- return h[x(192)]();
120
+ return c[x(210)]();
144
121
  });
145
122
  };
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();
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();
157
150
  }
158
- (function(r, n) {
159
- for (var e = M, x = r(); []; )
151
+ (function(n, a) {
152
+ for (var e = $, x = n(); []; )
160
153
  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)
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)
163
156
  break;
164
157
  x.push(x.shift());
165
- } catch (h) {
158
+ } catch (c) {
166
159
  x.push(x.shift());
167
160
  }
168
- })(k, 325633);
169
- function M(r, n) {
161
+ })(k, 444814);
162
+ function $(n, a) {
170
163
  var e = k();
171
- return M = function(x, l) {
172
- x = x - 210;
173
- var h = e[x];
174
- return h;
175
- }, M(r, n);
164
+ return $ = function(x, o) {
165
+ x = x - 484;
166
+ var c = e[x];
167
+ return c;
168
+ }, $(n, a);
169
+ }
170
+ 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"];
172
+ return k = function() {
173
+ return n;
174
+ }, k();
176
175
  }
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) };
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" };
183
182
  }
184
183
  export {
185
- K as default
184
+ X as default
186
185
  };
package/dist/index.umd.js CHANGED
@@ -1,12 +1,4 @@
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;
2
- }
3
- .hiprint-printTemplate .hiprint-printPanel-small {
4
- 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>
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>
10
2
  .hiprint-printPanel-small{
11
3
  box-sizing: border-box;
12
4
  border: 0px;
@@ -16,7 +8,10 @@
16
8
  padding: 0;
17
9
  }
18
10
  .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>
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;
12
+ }
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>
20
15
  .hiprint-printPanel-small{
21
16
  box-sizing: border-box;
22
17
  border: 0px;
@@ -30,4 +25,11 @@
30
25
  flex-wrap: wrap;
31
26
  flex-direction: column;
32
27
  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});
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});
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.0",
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
  }