@sv-print/plugin-api-pdf 0.1.0 → 0.1.2

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/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @sv-print/plugin-api-pdf
2
+
3
+ 给 sv-print 提供导出 PDF 的 API 插件。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install @sv-print/plugin-api-pdf
9
+ ```
10
+
11
+ ```js
12
+ import pluginApiPdf from "@sv-print/plugin-api-pdf";
13
+ const plugins = [pluginApiPdf({})];
14
+ ```
15
+
16
+ ## 示例
17
+
18
+ ```js
19
+ let hiprintTemplate = new hiprint.PrintTemplate(options);
20
+ // 其中 “text” 是一个元素的 “字段名(field)”
21
+ let printData = { text: "这是打印时显示的文本" };
22
+ const res = await hiprintTemplate.toPdf(printData, "pdf名称", {
23
+ isDownload: false, // 不自动下载
24
+ type: "blob", // 默认 blob 支持: blob、bloburl、pdfobjectnewwindow、dataurl --> jspdf.output(type)
25
+ onProgress: (cur, total) => {
26
+ const percent = Math.floor((cur / total) * 100);
27
+ console.log("toPdf 进度", percent);
28
+ },
29
+ });
30
+ console.log("toPdf", res);
31
+ ```
32
+
33
+ ## License
34
+
35
+ LGPL
36
+
37
+ ### 开源使用须知
38
+
39
+ 1.请自觉遵守 LGPL 协议,其他用途可联系作者;
40
+
41
+ 2.允许用于个人学习、毕业设计、教学案例、公益事业、商业使用;
42
+
43
+ 3.如果商用必须保留版权信息,请自觉遵守;
44
+
45
+ 4.禁止将本开源的代码和资源进行任何形式任何名义的出售,否则产生的一切任何后果责任由侵权者自负;
46
+
47
+ 5.商用请仔细审查代码和漏洞,不得用于任一国家许可范围之外的商业应用,产生的一切任何后果责任自负;
48
+
49
+ ```
50
+
51
+ ```
package/dist/index.js CHANGED
@@ -1 +1,33 @@
1
- "use strict";var O=(x,a,t)=>new Promise((e,o)=>{var s=c=>{try{f(t.next(c))}catch(u){o(u)}},m=c=>{try{f(t.throw(c))}catch(u){o(u)}},f=c=>c.done?e(c.value):Promise.resolve(c.value).then(s,m);f((t=t.apply(x,a)).next())});const D=require("html-to-image"),R=require("jspdf");function k(x){if(x&&x.__esModule)return x;const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(x){for(const t in x)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(x,t);Object.defineProperty(a,t,e.get?e:{enumerable:!0,get:()=>x[t]})}}return a.default=x,Object.freeze(a)}const q=k(D);function v(x,a){var t=I();return v=function(e,o){e=e-164;var s=t[e];return s},v(x,a)}(function(x,a){for(var t=v,e=x();[];)try{var o=-parseInt(t(203))/1+parseInt(t(164))/2+-parseInt(t(195))/3*(parseInt(t(197))/4)+-parseInt(t(173))/5*(parseInt(t(206))/6)+parseInt(t(225))/7+parseInt(t(180))/8+parseInt(t(184))/9;if(o===a)break;e.push(e.shift())}catch(s){e.push(e.shift())}})(I,636902);function I(){var x=["gif","split","6461058iQvSab","add","createTempContainer","#fff",".hiprint-printPanel .hiprint-printPaper","Deferred","imageSmoothingEnabled","svg","jpg","log","find","baseURI","removeTempContainer","toPdf percent: ","http","indexOf","webp","printPanels","width","6373367SGTiUH","run","getContext","clear","1637740tZXHMw","pop","IMG","promise","output","height","toDataURL",".pdf","toPt","5jLGsWV","getTempContainer","length","total","blob","isDownload","type","1143592JsWoRv","src","floor","error","2640312ONcCNU","toLocaleLowerCase","cur","extend","svg2canvas","queue","onProgress","getOrient","hinnn","css","getHtml","159laaTrO","tagName","9176MRMMSC","save","image/jpeg","each","position:fixed","addImage","330341BdDuQb"];return I=function(){return x},I()}const A=function(x,a,t){return O(this,null,function*(){var e=v,o=this,s=globalThis.$[e(211)](),m=!![];let f=(l,P)=>{var d=e;const r=Math[d(182)](l/P*100);console[d(215)](d(186),l,d(176),P),console[d(215)](d(219),r+"%")};if(this.printPanels[e(175)]){var c=globalThis[e(192)].mm[e(172)](this[e(223)][0].width),u=globalThis.hinnn.mm[e(172)](this.printPanels[0][e(169)]),y=globalThis.$[e(187)]({filter:r=>{var n=e;return r[n(196)]!=n(166)||r[n(196)]=="IMG"&&([n(214),"jpeg","png",n(204),"bmp",n(222),n(213)].includes(r[n(181)][n(205)](".")[n(165)]().toLowerCase())||r[n(181)]!=r[n(217)]||r[n(181)][n(221)](n(220))>-1&&r[n(181)]!=r[n(217)]||r[n(181)].indexOf("base64")>-1)},backgroundColor:e(209)},t||{});const l=this.printPanels[0].paperType,P=l!=null&&l!=""&&l!="\u81EA\u5B9A\u4E49";var h=new R.jsPDF({orientation:this[e(191)](0)==1?"portrait":"landscape",unit:"pt",format:P?l[e(185)]():[c,u]}),g=yield this[e(194)](x,t);t&&t.isDownload!=null&&(m=t[e(178)]),t&&t.onProgress!=null&&(f=t[e(190)]),globalThis.$(g)[e(193)](e(224),"").css("height",""),this[e(208)]();var j=this[e(174)]();this[e(188)](g,y),j.html(g[0]);let d=j[e(216)](e(210))[e(175)];globalThis.$(g)[e(193)](e(201)),this.loadAllImages(g,function(){var r=e;try{j[r(216)](r(210))[r(200)](function(n,_){var p=r;globalThis[p(192)][p(189)][p(207)](function(M){q.toCanvas(_,y).then(function(i){var b=v,C=i[b(227)]("2d");C[b(212)]=![];var G=i[b(170)](b(199),y.quality||.92);h[b(202)](G,"JPEG",0,0,c,u),n<d-1&&h.addPage(),f(n+1,d),M()})}),n==d-1&&(globalThis[p(192)][p(189)][p(207)](function(M){var i=p;if(m)o[i(218)](),a[i(221)](i(171))>-1?h[i(198)](a):h[i(198)](a+i(171));else{o[i(218)]();let b=t[i(179)]||i(177),C=h[i(168)](b);s.resolve(C)}globalThis[i(192)][i(189)][i(228)]()}),globalThis[p(192)].queue[p(226)]())})}catch(n){console[r(183)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "),console.log(n)}})}return s[e(167)]()})};(function(x,a){for(var t=w,e=x();[];)try{var o=-parseInt(t(272))/1+-parseInt(t(281))/2+-parseInt(t(270))/3+parseInt(t(275))/4*(-parseInt(t(271))/5)+parseInt(t(282))/6+parseInt(t(280))/7*(parseInt(t(274))/8)+parseInt(t(283))/9;if(o===a)break;e.push(e.shift())}catch(s){e.push(e.shift())}})(T,175929);function w(x,a){var t=T();return w=function(e,o){e=e-270;var s=t[e];return s},w(x,a)}function T(){var x=["newPrintTemplate","defineProperty","toPdf","2421566IwQKqK","19148rRCHpQ","578370uwOEGF","428796RGwMwp","add toPdf Api","486303dHnszW","335yooKeM","13532GMAfxs","0.3.0","8zyLrNt","7692RBKxwC","add toPdf Api to PrintTemplate"];return T=function(){return x},T()}function H(x){var a=w;return{name:a(284),description:"add toPdf Api",hooks:[{hook:a(277),name:a(276),description:"add toPdf Api to PrintTemplate",priority:1,run:({template:t,options:e})=>{var o=a;Object[o(278)](t,o(279),{value:A,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:a(273)}}module.exports=H;
1
+ "use strict";var R=(n,i,e)=>new Promise((x,p)=>{var b=t=>{try{h(e.next(t))}catch(u){p(u)}},w=t=>{try{h(e.throw(t))}catch(u){p(u)}},h=t=>t.done?x(t.value):Promise.resolve(t.value).then(b,w);h((e=e.apply(n,i)).next())});const A=require("html-to-image"),V=require("jspdf");function U(n){if(n&&n.__esModule)return n;const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const x=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(i,e,x.get?x:{enumerable:!0,get:()=>n[e]})}}return i.default=n,Object.freeze(i)}const W=U(A);(function(n,i){const e=T,x=n();for(;[];)try{if(parseInt(e(440))/1+parseInt(e(503))/2+parseInt(e(458))/3+parseInt(e(421))/4*(-parseInt(e(472))/5)+-parseInt(e(445))/6+-parseInt(e(488))/7*(parseInt(e(416))/8)+parseInt(e(467))/9===i)break;x.push(x.shift())}catch(p){x.push(x.shift())}})(O,707552);function T(n,i){const e=O();return T=function(x,p){return x=x-415,e[x]},T(n,i)}const B=function(n,i,e){return R(this,null,function*(){const x=T;var p=this,b=globalThis.$.Deferred(),w=!![];let h=(g,P)=>{const f=T,s=Math[f(444)](g/P*100);console[f(453)](f(477),g,f(463),P),console[f(453)](f(451),s+"%")},t=e||{};if(this[x(494)][x(475)]){if(typeof i=="string"){const r=i[x(464)](".pdf")>-1?i:i+x(452);t[x(419)]=r}else t=i||{},!t[x(419)]&&(t.name=x(497)+Date[x(473)]()+x(452));let g=this[x(494)][0][x(493)],P=this[x(494)][0].height;var u=globalThis[x(460)].mm.toPt(t[x(417)]||g),D=globalThis[x(460)].mm[x(449)](t[x(491)]||P),y=globalThis.$[x(489)]({filter:r=>{const a=x;return r[a(434)]!="IMG"||r.tagName=="IMG"&&([a(430),a(448),a(426),"gif",a(465),a(485),a(422)].includes(r[a(481)][a(418)](".")[a(433)]()[a(415)]())||r[a(481)]!=r[a(428)]||r[a(481)][a(464)](a(446))>-1&&r[a(481)]!=r[a(428)]||r.src.indexOf("base64")>-1)},backgroundColor:x(457)},t||{});const f=this.printPanels[0][x(427)],s=this.printPanels[0].panelLayoutOptions,$=s&&(s[x(484)]>0||s[x(483)]>0),z=f!=null&&f!=""&&f!="\u81EA\u5B9A\u4E49";var I=new V.jsPDF({orientation:this[x(486)](0)==1?x(482):x(455),unit:"pt",format:z?f[x(478)]():[u,D]}),m=yield this[x(439)](n,t);t&&t[x(507)]!=null&&(w=t[x(507)]),t&&t[x(462)]!=null&&(h=t[x(462)]),globalThis.$(m)[x(469)]("width","").css(x(459),""),this[x(425)]();var C=this.getTempContainer();if($&&t[x(417)]&&t[x(491)]){let r=Math[x(444)](t[x(417)]/(g+s[x(484)]/2)),a=Math[x(444)](t[x(491)]/(P+s[x(483)]/2));const v=r*a,l=m[x(435)](x(499)),_=l[x(475)],o=Math[x(474)](_/v);let c=globalThis.$(x(431));s[x(438)]=="row"?c[x(447)](x(429)+(Number(s[x(484)])||0)/2+x(468)+(Number(s[x(483)])||0)/2+x(432)+(Number(s.layoutRowGap)||0)/2+x(437)+(Number(s.layoutColumnGap)||0)/2+x(504)):c[x(447)](`<style>
2
+ .hiprint-printPanel-small{
3
+ box-sizing: border-box;
4
+ border: 0px;
5
+ }
6
+ .hiprint-printPaper-small{
7
+ position: relative;
8
+ padding: 0;
9
+ }
10
+ .hiprint-printTemplate .hiprint-printPaper{
11
+ display: flex;
12
+ flex-wrap: wrap;
13
+ flex-direction: column;
14
+ align-content: flex-start;
15
+ margin: -`+(Number(s[x(484)])||0)/2+x(468)+(Number(s[x(483)])||0)/2+x(432)+(Number(s[x(484)])||0)/2+x(437)+(Number(s[x(483)])||0)/2+x(504));for(let d=0;d<o;d++){const j=globalThis.$(`<div class="hiprint-printPanel">
16
+ <div class="hiprint-printPaper" style="width:`+t.paperWidth+x(420)+t[x(491)]+`mm;"></div>
17
+ </div>`),L=d*v,S=Math[x(487)]((d+1)*v,_);for(let N=L;N<S;N++){const k=l.eq(N)[x(505)]();k.removeClass(x(461)),k[x(506)](x(502)+N);const H=globalThis.$('<div class="hiprint-printPanel-small"></div>');H[x(447)](k),j[x(435)](x(443))[x(447)](H)}c[x(447)](j)}this[x(501)](c,y),C[x(466)](c[0]),globalThis.$(c)[x(469)](x(442))}else this[x(501)](m,y),C[x(466)](m[0]),globalThis.$(m)[x(469)](x(442));let G=C.find(".hiprint-printPanel .hiprint-printPaper")[x(475)];this.loadAllImages(m,function(){const r=x;try{C[r(435)](r(499))[r(495)](function(a,v){const l=r;globalThis[l(460)][l(436)][l(498)](function(_){const o=l;W[o(454)](v,y)[o(479)](function(c){const d=o;var j=c[d(496)]("2d");j[d(500)]=![];var L=c[d(423)](d(480),y.quality||.92);I.addImage(L,"JPEG",0,0,u,D),a<G-1&&I.addPage(),h(a+1,G),_()})[o(471)](c=>{const d=o;throw new Error(c[d(456)])})}),a==G-1&&(globalThis[l(460)][l(436)][l(498)](function(_){const o=l;if(w)p[o(470)](),I[o(476)](t[o(419)]);else{p[o(470)]();let c=t[o(441)]||o(490),d=I[o(450)](c);b.resolve(d)}globalThis[o(460)][o(436)].clear()}),globalThis[l(460)].queue[l(424)]())})}catch(a){console[r(492)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "),console[r(453)](a)}})}return b.promise()})};function O(){const n=["message","#fff","4208619DTbSZP","height","hinnn","hiprint-printPaper","onProgress","total","indexOf","bmp","html","5310000eweoHW","mm -","css","removeTempContainer","catch","65gLxMHl","now","ceil","length","save","cur","toLocaleLowerCase","then","image/jpeg","src","portrait","layoutColumnGap","layoutRowGap","webp","getOrient","min","32221ozycqv","extend","blob","paperHeight","error","width","printPanels","each","getContext","sv-print-","add",".hiprint-printPanel .hiprint-printPaper","imageSmoothingEnabled","svg2canvas","hiprint-printPaper-small start-","263716JLHqhL",`mm;
18
+ }
19
+ </style>`,"clone","addClass","isDownload","toLowerCase","1064OQuVRs","paperWidth","split","name","mm;height:","252012TUBfqm","svg","toDataURL","run","createTempContainer","png","paperType","baseURI",`<style>
20
+ .hiprint-printPanel-small{
21
+ box-sizing: border-box;
22
+ border: 0px;
23
+ }
24
+ .hiprint-printPaper-small{
25
+ position: relative;
26
+ padding: 0;
27
+ }
28
+ .hiprint-printTemplate .hiprint-printPaper{
29
+ margin: -`,"jpg",'<div class="hiprint-printTemplate"></div>',`mm;
30
+ }
31
+ .hiprint-printTemplate .hiprint-printPanel-small {
32
+ display:inline-block;
33
+ padding: `,"pop","tagName","find","queue","mm ","layoutType","getHtml","403090NSIRHY","type","position:fixed",".hiprint-printPaper","floor","2334186Csqjzd","http","append","jpeg","toPt","output","toPdf percent: ",".pdf","log","toCanvas","landscape"];return O=function(){return n},O()}(function(n,i){for(var e=q,x=n();[];)try{var p=parseInt(e(186))/1*(parseInt(e(181))/2)+parseInt(e(177))/3+parseInt(e(180))/4*(-parseInt(e(184))/5)+-parseInt(e(183))/6*(parseInt(e(187))/7)+-parseInt(e(176))/8*(-parseInt(e(174))/9)+-parseInt(e(182))/10+parseInt(e(179))/11;if(p===i)break;x.push(x.shift())}catch(b){x.push(x.shift())}})(M,137645);function q(n,i){var e=M();return q=function(x,p){x=x-172;var b=e[x];return b},q(n,i)}function M(){var n=["30969oTwVoo","add toPdf Api","8wHhBkC","559548rBzwwo","toPdf","3110712lnIVuv","4DFfgVw","82OKQCWw","89540jzfgLR","512610MGUCRx","1023220TKZNhr","defineProperty","1204Tvmeyj","14qGSnNa","newPrintTemplate","add toPdf Api to PrintTemplate","0.3.0"];return M=function(){return n},M()}function E(n){var i=q;return{name:"add toPdf Api",description:i(175),hooks:[{hook:i(188),name:"add toPdf Api to PrintTemplate",description:i(172),priority:1,run:({template:e,options:x})=>{var p=i;Object[p(185)](e,p(178),{value:B,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:i(173)}}module.exports=E;
package/dist/index.mjs CHANGED
@@ -1,129 +1,187 @@
1
- var O = (r, a, t) => new Promise((x, o) => {
2
- var s = (c) => {
1
+ var D = (o, n, e) => new Promise((x, p) => {
2
+ var b = (t) => {
3
3
  try {
4
- f(t.next(c));
5
- } catch (h) {
6
- o(h);
4
+ h(e.next(t));
5
+ } catch (m) {
6
+ p(m);
7
7
  }
8
- }, m = (c) => {
8
+ }, w = (t) => {
9
9
  try {
10
- f(t.throw(c));
11
- } catch (h) {
12
- o(h);
10
+ h(e.throw(t));
11
+ } catch (m) {
12
+ p(m);
13
13
  }
14
- }, f = (c) => c.done ? x(c.value) : Promise.resolve(c.value).then(s, m);
15
- f((t = t.apply(r, a)).next());
14
+ }, h = (t) => t.done ? x(t.value) : Promise.resolve(t.value).then(b, w);
15
+ h((e = e.apply(o, n)).next());
16
16
  });
17
- import * as A from "html-to-image";
18
- import { jsPDF as D } from "jspdf";
19
- function v(r, a) {
20
- var t = P();
21
- return v = function(x, o) {
22
- x = x - 164;
23
- var s = t[x];
24
- return s;
25
- }, v(r, a);
26
- }
27
- (function(r, a) {
28
- for (var t = v, x = r(); []; )
17
+ import * as V from "html-to-image";
18
+ import { jsPDF as S } from "jspdf";
19
+ (function(o, n) {
20
+ const e = T, x = o();
21
+ for (; []; )
29
22
  try {
30
- var o = -parseInt(t(203)) / 1 + parseInt(t(164)) / 2 + -parseInt(t(195)) / 3 * (parseInt(t(197)) / 4) + -parseInt(t(173)) / 5 * (parseInt(t(206)) / 6) + parseInt(t(225)) / 7 + parseInt(t(180)) / 8 + parseInt(t(184)) / 9;
31
- if (o === a)
23
+ if (parseInt(e(440)) / 1 + parseInt(e(503)) / 2 + parseInt(e(458)) / 3 + parseInt(e(421)) / 4 * (-parseInt(e(472)) / 5) + -parseInt(e(445)) / 6 + -parseInt(e(488)) / 7 * (parseInt(e(416)) / 8) + parseInt(e(467)) / 9 === n)
32
24
  break;
33
25
  x.push(x.shift());
34
- } catch (s) {
26
+ } catch (p) {
35
27
  x.push(x.shift());
36
28
  }
37
- })(P, 636902);
38
- function P() {
39
- var r = ["gif", "split", "6461058iQvSab", "add", "createTempContainer", "#fff", ".hiprint-printPanel .hiprint-printPaper", "Deferred", "imageSmoothingEnabled", "svg", "jpg", "log", "find", "baseURI", "removeTempContainer", "toPdf percent: ", "http", "indexOf", "webp", "printPanels", "width", "6373367SGTiUH", "run", "getContext", "clear", "1637740tZXHMw", "pop", "IMG", "promise", "output", "height", "toDataURL", ".pdf", "toPt", "5jLGsWV", "getTempContainer", "length", "total", "blob", "isDownload", "type", "1143592JsWoRv", "src", "floor", "error", "2640312ONcCNU", "toLocaleLowerCase", "cur", "extend", "svg2canvas", "queue", "onProgress", "getOrient", "hinnn", "css", "getHtml", "159laaTrO", "tagName", "9176MRMMSC", "save", "image/jpeg", "each", "position:fixed", "addImage", "330341BdDuQb"];
40
- return P = function() {
41
- return r;
42
- }, P();
29
+ })(G, 707552);
30
+ function T(o, n) {
31
+ const e = G();
32
+ return T = function(x, p) {
33
+ return x = x - 415, e[x];
34
+ }, T(o, n);
43
35
  }
44
- const H = function(r, a, t) {
45
- return O(this, null, function* () {
46
- var x = v, o = this, s = globalThis.$[x(211)](), m = !![];
47
- let f = (l, I) => {
48
- var d = x;
49
- const n = Math[d(182)](l / I * 100);
50
- console[d(215)](d(186), l, d(176), I), console[d(215)](d(219), n + "%");
51
- };
52
- if (this.printPanels[x(175)]) {
53
- var c = globalThis[x(192)].mm[x(172)](this[x(223)][0].width), h = globalThis.hinnn.mm[x(172)](this.printPanels[0][x(169)]), C = globalThis.$[x(187)]({ filter: (n) => {
54
- var e = x;
55
- return n[e(196)] != e(166) || n[e(196)] == "IMG" && ([e(214), "jpeg", "png", e(204), "bmp", e(222), e(213)].includes(n[e(181)][e(205)](".")[e(165)]().toLowerCase()) || n[e(181)] != n[e(217)] || n[e(181)][e(221)](e(220)) > -1 && n[e(181)] != n[e(217)] || n[e(181)].indexOf("base64") > -1);
56
- }, backgroundColor: x(209) }, t || {});
57
- const l = this.printPanels[0].paperType, I = l != null && l != "" && l != "\u81EA\u5B9A\u4E49";
58
- var u = new D({ orientation: this[x(191)](0) == 1 ? "portrait" : "landscape", unit: "pt", format: I ? l[x(185)]() : [c, h] }), g = yield this[x(194)](r, t);
59
- t && t.isDownload != null && (m = t[x(178)]), t && t.onProgress != null && (f = t[x(190)]), globalThis.$(g)[x(193)](x(224), "").css("height", ""), this[x(208)]();
60
- var y = this[x(174)]();
61
- this[x(188)](g, C), y.html(g[0]);
62
- let d = y[x(216)](x(210))[x(175)];
63
- globalThis.$(g)[x(193)](x(201)), this.loadAllImages(g, function() {
64
- var n = x;
36
+ const U = function(o, n, e) {
37
+ return D(this, null, function* () {
38
+ const x = T;
39
+ var p = this, b = globalThis.$.Deferred(), w = !![];
40
+ let h = (g, v) => {
41
+ const f = T, s = Math[f(444)](g / v * 100);
42
+ console[f(453)](f(477), g, f(463), v), console[f(453)](f(451), s + "%");
43
+ }, t = e || {};
44
+ if (this[x(494)][x(475)]) {
45
+ if (typeof n == "string") {
46
+ const i = n[x(464)](".pdf") > -1 ? n : n + x(452);
47
+ t[x(419)] = i;
48
+ } else
49
+ t = n || {}, !t[x(419)] && (t.name = x(497) + Date[x(473)]() + x(452));
50
+ let g = this[x(494)][0][x(493)], v = this[x(494)][0].height;
51
+ var m = globalThis[x(460)].mm.toPt(t[x(417)] || g), $ = globalThis[x(460)].mm[x(449)](t[x(491)] || v), I = globalThis.$[x(489)]({ filter: (i) => {
52
+ const a = x;
53
+ return i[a(434)] != "IMG" || i.tagName == "IMG" && ([a(430), a(448), a(426), "gif", a(465), a(485), a(422)].includes(i[a(481)][a(418)](".")[a(433)]()[a(415)]()) || i[a(481)] != i[a(428)] || i[a(481)][a(464)](a(446)) > -1 && i[a(481)] != i[a(428)] || i.src.indexOf("base64") > -1);
54
+ }, backgroundColor: x(457) }, t || {});
55
+ const f = this.printPanels[0][x(427)], s = this.printPanels[0].panelLayoutOptions, O = s && (s[x(484)] > 0 || s[x(483)] > 0), z = f != null && f != "" && f != "\u81EA\u5B9A\u4E49";
56
+ var y = new S({ orientation: this[x(486)](0) == 1 ? x(482) : x(455), unit: "pt", format: z ? f[x(478)]() : [m, $] }), u = yield this[x(439)](o, t);
57
+ t && t[x(507)] != null && (w = t[x(507)]), t && t[x(462)] != null && (h = t[x(462)]), globalThis.$(u)[x(469)]("width", "").css(x(459), ""), this[x(425)]();
58
+ var C = this.getTempContainer();
59
+ if (O && t[x(417)] && t[x(491)]) {
60
+ let i = Math[x(444)](t[x(417)] / (g + s[x(484)] / 2)), a = Math[x(444)](t[x(491)] / (v + s[x(483)] / 2));
61
+ const P = i * a, l = u[x(435)](x(499)), _ = l[x(475)], r = Math[x(474)](_ / P);
62
+ let c = globalThis.$(x(431));
63
+ s[x(438)] == "row" ? c[x(447)](x(429) + (Number(s[x(484)]) || 0) / 2 + x(468) + (Number(s[x(483)]) || 0) / 2 + x(432) + (Number(s.layoutRowGap) || 0) / 2 + x(437) + (Number(s.layoutColumnGap) || 0) / 2 + x(504)) : c[x(447)](`<style>
64
+ .hiprint-printPanel-small{
65
+ box-sizing: border-box;
66
+ border: 0px;
67
+ }
68
+ .hiprint-printPaper-small{
69
+ position: relative;
70
+ padding: 0;
71
+ }
72
+ .hiprint-printTemplate .hiprint-printPaper{
73
+ display: flex;
74
+ flex-wrap: wrap;
75
+ flex-direction: column;
76
+ align-content: flex-start;
77
+ margin: -` + (Number(s[x(484)]) || 0) / 2 + x(468) + (Number(s[x(483)]) || 0) / 2 + x(432) + (Number(s[x(484)]) || 0) / 2 + x(437) + (Number(s[x(483)]) || 0) / 2 + x(504));
78
+ for (let d = 0; d < r; d++) {
79
+ const N = globalThis.$(`<div class="hiprint-printPanel">
80
+ <div class="hiprint-printPaper" style="width:` + t.paperWidth + x(420) + t[x(491)] + `mm;"></div>
81
+ </div>`), H = d * P, A = Math[x(487)]((d + 1) * P, _);
82
+ for (let q = H; q < A; q++) {
83
+ const R = l.eq(q)[x(505)]();
84
+ R.removeClass(x(461)), R[x(506)](x(502) + q);
85
+ const k = globalThis.$('<div class="hiprint-printPanel-small"></div>');
86
+ k[x(447)](R), N[x(435)](x(443))[x(447)](k);
87
+ }
88
+ c[x(447)](N);
89
+ }
90
+ this[x(501)](c, I), C[x(466)](c[0]), globalThis.$(c)[x(469)](x(442));
91
+ } else
92
+ this[x(501)](u, I), C[x(466)](u[0]), globalThis.$(u)[x(469)](x(442));
93
+ let j = C.find(".hiprint-printPanel .hiprint-printPaper")[x(475)];
94
+ this.loadAllImages(u, function() {
95
+ const i = x;
65
96
  try {
66
- y[n(216)](n(210))[n(200)](function(e, R) {
67
- var p = n;
68
- globalThis[p(192)][p(189)][p(207)](function(G) {
69
- A.toCanvas(R, C).then(function(i) {
70
- var b = v, M = i[b(227)]("2d");
71
- M[b(212)] = ![];
72
- var j = i[b(170)](b(199), C.quality || 0.92);
73
- u[b(202)](j, "JPEG", 0, 0, c, h), e < d - 1 && u.addPage(), f(e + 1, d), G();
97
+ C[i(435)](i(499))[i(495)](function(a, P) {
98
+ const l = i;
99
+ globalThis[l(460)][l(436)][l(498)](function(_) {
100
+ const r = l;
101
+ V[r(454)](P, I)[r(479)](function(c) {
102
+ const d = r;
103
+ var N = c[d(496)]("2d");
104
+ N[d(500)] = ![];
105
+ var H = c[d(423)](d(480), I.quality || 0.92);
106
+ y.addImage(H, "JPEG", 0, 0, m, $), a < j - 1 && y.addPage(), h(a + 1, j), _();
107
+ })[r(471)]((c) => {
108
+ const d = r;
109
+ throw new Error(c[d(456)]);
74
110
  });
75
- }), e == d - 1 && (globalThis[p(192)][p(189)][p(207)](function(G) {
76
- var i = p;
77
- if (m)
78
- o[i(218)](), a[i(221)](i(171)) > -1 ? u[i(198)](a) : u[i(198)](a + i(171));
111
+ }), a == j - 1 && (globalThis[l(460)][l(436)][l(498)](function(_) {
112
+ const r = l;
113
+ if (w)
114
+ p[r(470)](), y[r(476)](t[r(419)]);
79
115
  else {
80
- o[i(218)]();
81
- let b = t[i(179)] || i(177), M = u[i(168)](b);
82
- s.resolve(M);
116
+ p[r(470)]();
117
+ let c = t[r(441)] || r(490), d = y[r(450)](c);
118
+ b.resolve(d);
83
119
  }
84
- globalThis[i(192)][i(189)][i(228)]();
85
- }), globalThis[p(192)].queue[p(226)]());
120
+ globalThis[r(460)][r(436)].clear();
121
+ }), globalThis[l(460)].queue[l(424)]());
86
122
  });
87
- } catch (e) {
88
- console[n(183)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "), console.log(e);
123
+ } catch (a) {
124
+ console[i(492)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "), console[i(453)](a);
89
125
  }
90
126
  });
91
127
  }
92
- return s[x(167)]();
128
+ return b.promise();
93
129
  });
94
130
  };
95
- (function(r, a) {
96
- for (var t = w, x = r(); []; )
131
+ function G() {
132
+ const o = ["message", "#fff", "4208619DTbSZP", "height", "hinnn", "hiprint-printPaper", "onProgress", "total", "indexOf", "bmp", "html", "5310000eweoHW", "mm -", "css", "removeTempContainer", "catch", "65gLxMHl", "now", "ceil", "length", "save", "cur", "toLocaleLowerCase", "then", "image/jpeg", "src", "portrait", "layoutColumnGap", "layoutRowGap", "webp", "getOrient", "min", "32221ozycqv", "extend", "blob", "paperHeight", "error", "width", "printPanels", "each", "getContext", "sv-print-", "add", ".hiprint-printPanel .hiprint-printPaper", "imageSmoothingEnabled", "svg2canvas", "hiprint-printPaper-small start-", "263716JLHqhL", `mm;
133
+ }
134
+ </style>`, "clone", "addClass", "isDownload", "toLowerCase", "1064OQuVRs", "paperWidth", "split", "name", "mm;height:", "252012TUBfqm", "svg", "toDataURL", "run", "createTempContainer", "png", "paperType", "baseURI", `<style>
135
+ .hiprint-printPanel-small{
136
+ box-sizing: border-box;
137
+ border: 0px;
138
+ }
139
+ .hiprint-printPaper-small{
140
+ position: relative;
141
+ padding: 0;
142
+ }
143
+ .hiprint-printTemplate .hiprint-printPaper{
144
+ margin: -`, "jpg", '<div class="hiprint-printTemplate"></div>', `mm;
145
+ }
146
+ .hiprint-printTemplate .hiprint-printPanel-small {
147
+ display:inline-block;
148
+ padding: `, "pop", "tagName", "find", "queue", "mm ", "layoutType", "getHtml", "403090NSIRHY", "type", "position:fixed", ".hiprint-printPaper", "floor", "2334186Csqjzd", "http", "append", "jpeg", "toPt", "output", "toPdf percent: ", ".pdf", "log", "toCanvas", "landscape"];
149
+ return G = function() {
150
+ return o;
151
+ }, G();
152
+ }
153
+ (function(o, n) {
154
+ for (var e = L, x = o(); []; )
97
155
  try {
98
- var o = -parseInt(t(272)) / 1 + -parseInt(t(281)) / 2 + -parseInt(t(270)) / 3 + parseInt(t(275)) / 4 * (-parseInt(t(271)) / 5) + parseInt(t(282)) / 6 + parseInt(t(280)) / 7 * (parseInt(t(274)) / 8) + parseInt(t(283)) / 9;
99
- if (o === a)
156
+ var p = parseInt(e(186)) / 1 * (parseInt(e(181)) / 2) + parseInt(e(177)) / 3 + parseInt(e(180)) / 4 * (-parseInt(e(184)) / 5) + -parseInt(e(183)) / 6 * (parseInt(e(187)) / 7) + -parseInt(e(176)) / 8 * (-parseInt(e(174)) / 9) + -parseInt(e(182)) / 10 + parseInt(e(179)) / 11;
157
+ if (p === n)
100
158
  break;
101
159
  x.push(x.shift());
102
- } catch (s) {
160
+ } catch (b) {
103
161
  x.push(x.shift());
104
162
  }
105
- })(T, 175929);
106
- function w(r, a) {
107
- var t = T();
108
- return w = function(x, o) {
109
- x = x - 270;
110
- var s = t[x];
111
- return s;
112
- }, w(r, a);
163
+ })(M, 137645);
164
+ function L(o, n) {
165
+ var e = M();
166
+ return L = function(x, p) {
167
+ x = x - 172;
168
+ var b = e[x];
169
+ return b;
170
+ }, L(o, n);
113
171
  }
114
- function T() {
115
- var r = ["newPrintTemplate", "defineProperty", "toPdf", "2421566IwQKqK", "19148rRCHpQ", "578370uwOEGF", "428796RGwMwp", "add toPdf Api", "486303dHnszW", "335yooKeM", "13532GMAfxs", "0.3.0", "8zyLrNt", "7692RBKxwC", "add toPdf Api to PrintTemplate"];
116
- return T = function() {
117
- return r;
118
- }, T();
172
+ function M() {
173
+ var o = ["30969oTwVoo", "add toPdf Api", "8wHhBkC", "559548rBzwwo", "toPdf", "3110712lnIVuv", "4DFfgVw", "82OKQCWw", "89540jzfgLR", "512610MGUCRx", "1023220TKZNhr", "defineProperty", "1204Tvmeyj", "14qGSnNa", "newPrintTemplate", "add toPdf Api to PrintTemplate", "0.3.0"];
174
+ return M = function() {
175
+ return o;
176
+ }, M();
119
177
  }
120
- function q(r) {
121
- var a = w;
122
- return { name: a(284), description: "add toPdf Api", hooks: [{ hook: a(277), name: a(276), description: "add toPdf Api to PrintTemplate", priority: 1, run: ({ template: t, options: x }) => {
123
- var o = a;
124
- Object[o(278)](t, o(279), { value: H, enumerable: ![], writable: !![], configurable: !![] });
125
- } }], leastHiprintVersion: a(273) };
178
+ function E(o) {
179
+ var n = L;
180
+ return { name: "add toPdf Api", description: n(175), hooks: [{ hook: n(188), name: "add toPdf Api to PrintTemplate", description: n(172), priority: 1, run: ({ template: e, options: x }) => {
181
+ var p = n;
182
+ Object[p(185)](e, p(178), { value: U, enumerable: ![], writable: !![], configurable: !![] });
183
+ } }], leastHiprintVersion: n(173) };
126
184
  }
127
185
  export {
128
- q as default
186
+ E as default
129
187
  };
package/dist/index.umd.js CHANGED
@@ -1 +1,33 @@
1
- (function(c,b){typeof exports=="object"&&typeof module!="undefined"?module.exports=b(require("html-to-image"),require("jspdf")):typeof define=="function"&&define.amd?define(["html-to-image","jspdf"],b):(c=typeof globalThis!="undefined"?globalThis:c||self,c.pluginApiPdf=b(c.htmlToImage,c.jspdf))})(this,function(c,b){"use strict";var k=(c,b,m)=>new Promise((y,l)=>{var v=o=>{try{f(m.next(o))}catch(P){l(P)}},j=o=>{try{f(m.throw(o))}catch(P){l(P)}},f=o=>o.done?y(o.value):Promise.resolve(o.value).then(v,j);f((m=m.apply(c,b)).next())});function m(n){if(n&&n.__esModule)return n;const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(a,t,e.get?e:{enumerable:!0,get:()=>n[t]})}}return a.default=n,Object.freeze(a)}const y=m(c);function l(n,a){var t=v();return l=function(e,s){e=e-164;var u=t[e];return u},l(n,a)}(function(n,a){for(var t=l,e=n();[];)try{var s=-parseInt(t(203))/1+parseInt(t(164))/2+-parseInt(t(195))/3*(parseInt(t(197))/4)+-parseInt(t(173))/5*(parseInt(t(206))/6)+parseInt(t(225))/7+parseInt(t(180))/8+parseInt(t(184))/9;if(s===a)break;e.push(e.shift())}catch(u){e.push(e.shift())}})(v,636902);function v(){var n=["gif","split","6461058iQvSab","add","createTempContainer","#fff",".hiprint-printPanel .hiprint-printPaper","Deferred","imageSmoothingEnabled","svg","jpg","log","find","baseURI","removeTempContainer","toPdf percent: ","http","indexOf","webp","printPanels","width","6373367SGTiUH","run","getContext","clear","1637740tZXHMw","pop","IMG","promise","output","height","toDataURL",".pdf","toPt","5jLGsWV","getTempContainer","length","total","blob","isDownload","type","1143592JsWoRv","src","floor","error","2640312ONcCNU","toLocaleLowerCase","cur","extend","svg2canvas","queue","onProgress","getOrient","hinnn","css","getHtml","159laaTrO","tagName","9176MRMMSC","save","image/jpeg","each","position:fixed","addImage","330341BdDuQb"];return v=function(){return n},v()}const j=function(n,a,t){return k(this,null,function*(){var e=l,s=this,u=globalThis.$[e(211)](),G=!![];let _=(h,w)=>{var d=e;const r=Math[d(182)](h/w*100);console[d(215)](d(186),h,d(176),w),console[d(215)](d(219),r+"%")};if(this.printPanels[e(175)]){var A=globalThis[e(192)].mm[e(172)](this[e(223)][0].width),D=globalThis.hinnn.mm[e(172)](this.printPanels[0][e(169)]),C=globalThis.$[e(187)]({filter:r=>{var x=e;return r[x(196)]!=x(166)||r[x(196)]=="IMG"&&([x(214),"jpeg","png",x(204),"bmp",x(222),x(213)].includes(r[x(181)][x(205)](".")[x(165)]().toLowerCase())||r[x(181)]!=r[x(217)]||r[x(181)][x(221)](x(220))>-1&&r[x(181)]!=r[x(217)]||r[x(181)].indexOf("base64")>-1)},backgroundColor:e(209)},t||{});const h=this.printPanels[0].paperType,w=h!=null&&h!=""&&h!="\u81EA\u5B9A\u4E49";var I=new b.jsPDF({orientation:this[e(191)](0)==1?"portrait":"landscape",unit:"pt",format:w?h[e(185)]():[A,D]}),T=yield this[e(194)](n,t);t&&t.isDownload!=null&&(G=t[e(178)]),t&&t.onProgress!=null&&(_=t[e(190)]),globalThis.$(T)[e(193)](e(224),"").css("height",""),this[e(208)]();var M=this[e(174)]();this[e(188)](T,C),M.html(T[0]);let d=M[e(216)](e(210))[e(175)];globalThis.$(T)[e(193)](e(201)),this.loadAllImages(T,function(){var r=e;try{M[r(216)](r(210))[r(200)](function(x,q){var p=r;globalThis[p(192)][p(189)][p(207)](function(R){y.toCanvas(q,C).then(function(i){var g=l,O=i[g(227)]("2d");O[g(212)]=![];var H=i[g(170)](g(199),C.quality||.92);I[g(202)](H,"JPEG",0,0,A,D),x<d-1&&I.addPage(),_(x+1,d),R()})}),x==d-1&&(globalThis[p(192)][p(189)][p(207)](function(R){var i=p;if(G)s[i(218)](),a[i(221)](i(171))>-1?I[i(198)](a):I[i(198)](a+i(171));else{s[i(218)]();let g=t[i(179)]||i(177),O=I[i(168)](g);u.resolve(O)}globalThis[i(192)][i(189)][i(228)]()}),globalThis[p(192)].queue[p(226)]())})}catch(x){console[r(183)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "),console.log(x)}})}return u[e(167)]()})};(function(n,a){for(var t=f,e=n();[];)try{var s=-parseInt(t(272))/1+-parseInt(t(281))/2+-parseInt(t(270))/3+parseInt(t(275))/4*(-parseInt(t(271))/5)+parseInt(t(282))/6+parseInt(t(280))/7*(parseInt(t(274))/8)+parseInt(t(283))/9;if(s===a)break;e.push(e.shift())}catch(u){e.push(e.shift())}})(o,175929);function f(n,a){var t=o();return f=function(e,s){e=e-270;var u=t[e];return u},f(n,a)}function o(){var n=["newPrintTemplate","defineProperty","toPdf","2421566IwQKqK","19148rRCHpQ","578370uwOEGF","428796RGwMwp","add toPdf Api","486303dHnszW","335yooKeM","13532GMAfxs","0.3.0","8zyLrNt","7692RBKxwC","add toPdf Api to PrintTemplate"];return o=function(){return n},o()}function P(n){var a=f;return{name:a(284),description:"add toPdf Api",hooks:[{hook:a(277),name:a(276),description:"add toPdf Api to PrintTemplate",priority:1,run:({template:t,options:e})=>{var s=a;Object[s(278)](t,s(279),{value:j,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:a(273)}}return P});
1
+ (function(h,g){typeof exports=="object"&&typeof module!="undefined"?module.exports=g(require("html-to-image"),require("jspdf")):typeof define=="function"&&define.amd?define(["html-to-image","jspdf"],g):(h=typeof globalThis!="undefined"?globalThis:h||self,h.pluginApiPdf=g(h.htmlToImage,h.jspdf))})(this,function(h,g){"use strict";var U=(h,g,P)=>new Promise((L,u)=>{var k=d=>{try{m(P.next(d))}catch(y){u(y)}},v=d=>{try{m(P.throw(d))}catch(y){u(y)}},m=d=>d.done?L(d.value):Promise.resolve(d.value).then(k,v);m((P=P.apply(h,g)).next())});function P(a){if(a&&a.__esModule)return a;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const x=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(n,e,x.get?x:{enumerable:!0,get:()=>a[e]})}}return n.default=a,Object.freeze(n)}const L=P(h);(function(a,n){const e=u,x=a();for(;[];)try{if(parseInt(e(440))/1+parseInt(e(503))/2+parseInt(e(458))/3+parseInt(e(421))/4*(-parseInt(e(472))/5)+-parseInt(e(445))/6+-parseInt(e(488))/7*(parseInt(e(416))/8)+parseInt(e(467))/9===n)break;x.push(x.shift())}catch(f){x.push(x.shift())}})(v,707552);function u(a,n){const e=v();return u=function(x,f){return x=x-415,e[x]},u(a,n)}const k=function(a,n,e){return U(this,null,function*(){const x=u;var f=this,_=globalThis.$.Deferred(),$=!![];let z=(w,I)=>{const b=u,s=Math[b(444)](w/I*100);console[b(453)](b(477),w,b(463),I),console[b(453)](b(451),s+"%")},i=e||{};if(this[x(494)][x(475)]){if(typeof n=="string"){const r=n[x(464)](".pdf")>-1?n:n+x(452);i[x(419)]=r}else i=n||{},!i[x(419)]&&(i.name=x(497)+Date[x(473)]()+x(452));let w=this[x(494)][0][x(493)],I=this[x(494)][0].height;var A=globalThis[x(460)].mm.toPt(i[x(417)]||w),S=globalThis[x(460)].mm[x(449)](i[x(491)]||I),N=globalThis.$[x(489)]({filter:r=>{const t=x;return r[t(434)]!="IMG"||r.tagName=="IMG"&&([t(430),t(448),t(426),"gif",t(465),t(485),t(422)].includes(r[t(481)][t(418)](".")[t(433)]()[t(415)]())||r[t(481)]!=r[t(428)]||r[t(481)][t(464)](t(446))>-1&&r[t(481)]!=r[t(428)]||r.src.indexOf("base64")>-1)},backgroundColor:x(457)},i||{});const b=this.printPanels[0][x(427)],s=this.printPanels[0].panelLayoutOptions,W=s&&(s[x(484)]>0||s[x(483)]>0),B=b!=null&&b!=""&&b!="\u81EA\u5B9A\u4E49";var O=new g.jsPDF({orientation:this[x(486)](0)==1?x(482):x(455),unit:"pt",format:B?b[x(478)]():[A,S]}),T=yield this[x(439)](a,i);i&&i[x(507)]!=null&&($=i[x(507)]),i&&i[x(462)]!=null&&(z=i[x(462)]),globalThis.$(T)[x(469)]("width","").css(x(459),""),this[x(425)]();var q=this.getTempContainer();if(W&&i[x(417)]&&i[x(491)]){let r=Math[x(444)](i[x(417)]/(w+s[x(484)]/2)),t=Math[x(444)](i[x(491)]/(I+s[x(483)]/2));const j=r*t,p=T[x(435)](x(499)),C=p[x(475)],o=Math[x(474)](C/j);let l=globalThis.$(x(431));s[x(438)]=="row"?l[x(447)](x(429)+(Number(s[x(484)])||0)/2+x(468)+(Number(s[x(483)])||0)/2+x(432)+(Number(s.layoutRowGap)||0)/2+x(437)+(Number(s.layoutColumnGap)||0)/2+x(504)):l[x(447)](`<style>
2
+ .hiprint-printPanel-small{
3
+ box-sizing: border-box;
4
+ border: 0px;
5
+ }
6
+ .hiprint-printPaper-small{
7
+ position: relative;
8
+ padding: 0;
9
+ }
10
+ .hiprint-printTemplate .hiprint-printPaper{
11
+ display: flex;
12
+ flex-wrap: wrap;
13
+ flex-direction: column;
14
+ align-content: flex-start;
15
+ margin: -`+(Number(s[x(484)])||0)/2+x(468)+(Number(s[x(483)])||0)/2+x(432)+(Number(s[x(484)])||0)/2+x(437)+(Number(s[x(483)])||0)/2+x(504));for(let c=0;c<o;c++){const M=globalThis.$(`<div class="hiprint-printPanel">
16
+ <div class="hiprint-printPaper" style="width:`+i.paperWidth+x(420)+i[x(491)]+`mm;"></div>
17
+ </div>`),H=c*j,E=Math[x(487)]((c+1)*j,C);for(let G=H;G<E;G++){const R=p.eq(G)[x(505)]();R.removeClass(x(461)),R[x(506)](x(502)+G);const V=globalThis.$('<div class="hiprint-printPanel-small"></div>');V[x(447)](R),M[x(435)](x(443))[x(447)](V)}l[x(447)](M)}this[x(501)](l,N),q[x(466)](l[0]),globalThis.$(l)[x(469)](x(442))}else this[x(501)](T,N),q[x(466)](T[0]),globalThis.$(T)[x(469)](x(442));let D=q.find(".hiprint-printPanel .hiprint-printPaper")[x(475)];this.loadAllImages(T,function(){const r=x;try{q[r(435)](r(499))[r(495)](function(t,j){const p=r;globalThis[p(460)][p(436)][p(498)](function(C){const o=p;L[o(454)](j,N)[o(479)](function(l){const c=o;var M=l[c(496)]("2d");M[c(500)]=![];var H=l[c(423)](c(480),N.quality||.92);O.addImage(H,"JPEG",0,0,A,S),t<D-1&&O.addPage(),z(t+1,D),C()})[o(471)](l=>{const c=o;throw new Error(l[c(456)])})}),t==D-1&&(globalThis[p(460)][p(436)][p(498)](function(C){const o=p;if($)f[o(470)](),O[o(476)](i[o(419)]);else{f[o(470)]();let l=i[o(441)]||o(490),c=O[o(450)](l);_.resolve(c)}globalThis[o(460)][o(436)].clear()}),globalThis[p(460)].queue[p(424)]())})}catch(t){console[r(492)]("toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "),console[r(453)](t)}})}return _.promise()})};function v(){const a=["message","#fff","4208619DTbSZP","height","hinnn","hiprint-printPaper","onProgress","total","indexOf","bmp","html","5310000eweoHW","mm -","css","removeTempContainer","catch","65gLxMHl","now","ceil","length","save","cur","toLocaleLowerCase","then","image/jpeg","src","portrait","layoutColumnGap","layoutRowGap","webp","getOrient","min","32221ozycqv","extend","blob","paperHeight","error","width","printPanels","each","getContext","sv-print-","add",".hiprint-printPanel .hiprint-printPaper","imageSmoothingEnabled","svg2canvas","hiprint-printPaper-small start-","263716JLHqhL",`mm;
18
+ }
19
+ </style>`,"clone","addClass","isDownload","toLowerCase","1064OQuVRs","paperWidth","split","name","mm;height:","252012TUBfqm","svg","toDataURL","run","createTempContainer","png","paperType","baseURI",`<style>
20
+ .hiprint-printPanel-small{
21
+ box-sizing: border-box;
22
+ border: 0px;
23
+ }
24
+ .hiprint-printPaper-small{
25
+ position: relative;
26
+ padding: 0;
27
+ }
28
+ .hiprint-printTemplate .hiprint-printPaper{
29
+ margin: -`,"jpg",'<div class="hiprint-printTemplate"></div>',`mm;
30
+ }
31
+ .hiprint-printTemplate .hiprint-printPanel-small {
32
+ display:inline-block;
33
+ padding: `,"pop","tagName","find","queue","mm ","layoutType","getHtml","403090NSIRHY","type","position:fixed",".hiprint-printPaper","floor","2334186Csqjzd","http","append","jpeg","toPt","output","toPdf percent: ",".pdf","log","toCanvas","landscape"];return v=function(){return a},v()}(function(a,n){for(var e=m,x=a();[];)try{var f=parseInt(e(186))/1*(parseInt(e(181))/2)+parseInt(e(177))/3+parseInt(e(180))/4*(-parseInt(e(184))/5)+-parseInt(e(183))/6*(parseInt(e(187))/7)+-parseInt(e(176))/8*(-parseInt(e(174))/9)+-parseInt(e(182))/10+parseInt(e(179))/11;if(f===n)break;x.push(x.shift())}catch(_){x.push(x.shift())}})(d,137645);function m(a,n){var e=d();return m=function(x,f){x=x-172;var _=e[x];return _},m(a,n)}function d(){var a=["30969oTwVoo","add toPdf Api","8wHhBkC","559548rBzwwo","toPdf","3110712lnIVuv","4DFfgVw","82OKQCWw","89540jzfgLR","512610MGUCRx","1023220TKZNhr","defineProperty","1204Tvmeyj","14qGSnNa","newPrintTemplate","add toPdf Api to PrintTemplate","0.3.0"];return d=function(){return a},d()}function y(a){var n=m;return{name:"add toPdf Api",description:n(175),hooks:[{hook:n(188),name:"add toPdf Api to PrintTemplate",description:n(172),priority:1,run:({template:e,options:x})=>{var f=n;Object[f(185)](e,f(178),{value:k,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:n(173)}}return y});
package/dist/toPdf.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const toPdf: (t: any, e: any, options: any) => Promise<any>;
1
+ declare const toPdf: (printData: any, nameOrOptions: any, oldOpt: any) => Promise<any>;
2
2
  export { toPdf };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-pdf",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "add pdf api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",