@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 +12 -8
- package/dist/index.mjs +127 -125
- package/dist/index.umd.js +12 -8
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";var
|
|
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: `,
|
|
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(
|
|
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(
|
|
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
|
|
2
|
-
var h = (
|
|
1
|
+
var O = (n, e, a) => new Promise((x, o) => {
|
|
2
|
+
var h = (t) => {
|
|
3
3
|
try {
|
|
4
|
-
b(
|
|
4
|
+
b(a.next(t));
|
|
5
5
|
} catch (m) {
|
|
6
|
-
|
|
6
|
+
o(m);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, w = (t) => {
|
|
9
9
|
try {
|
|
10
|
-
b(
|
|
10
|
+
b(a.throw(t));
|
|
11
11
|
} catch (m) {
|
|
12
|
-
|
|
12
|
+
o(m);
|
|
13
13
|
}
|
|
14
|
-
}, b = (
|
|
15
|
-
b((
|
|
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
|
|
18
|
-
import { jsPDF as
|
|
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
|
|
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: `,
|
|
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
|
|
41
|
+
return n;
|
|
31
42
|
}, N();
|
|
32
43
|
}
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
58
|
-
let
|
|
59
|
-
var m = globalThis[x(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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(
|
|
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(
|
|
96
|
-
for (let
|
|
97
|
-
const
|
|
98
|
-
for (let
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
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
|
-
|
|
111
|
+
l[x(316)](M);
|
|
105
112
|
}
|
|
106
|
-
this[x(
|
|
113
|
+
this[x(345)](l, u), v[x(341)](l[0]), globalThis.$(l)[x(312)](x(269));
|
|
107
114
|
} else
|
|
108
|
-
this
|
|
109
|
-
let
|
|
110
|
-
this
|
|
111
|
-
const
|
|
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
|
-
|
|
114
|
-
const
|
|
115
|
-
globalThis
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
})
|
|
124
|
-
|
|
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
|
-
}),
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
|
|
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
|
-
|
|
132
|
-
let
|
|
133
|
-
h[
|
|
139
|
+
o.removeTempContainer();
|
|
140
|
+
let l = t[s(332)] || s(330), r = C.output(l);
|
|
141
|
+
h[s(260)](r);
|
|
134
142
|
}
|
|
135
|
-
globalThis[
|
|
136
|
-
}), globalThis
|
|
143
|
+
globalThis[s(299)][s(275)][s(324)]();
|
|
144
|
+
}), globalThis[p(299)][p(275)][p(326)]());
|
|
137
145
|
});
|
|
138
|
-
} catch (
|
|
139
|
-
console[
|
|
146
|
+
} catch (f) {
|
|
147
|
+
console[c(273)](c(348)), console[c(297)](f);
|
|
140
148
|
}
|
|
141
149
|
});
|
|
142
150
|
}
|
|
143
|
-
return h
|
|
151
|
+
return h.promise();
|
|
144
152
|
});
|
|
145
153
|
};
|
|
146
|
-
function
|
|
147
|
-
|
|
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
|
|
162
|
-
if (
|
|
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,
|
|
169
|
-
function
|
|
170
|
-
var
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
},
|
|
177
|
+
}, D(n, e);
|
|
176
178
|
}
|
|
177
|
-
function
|
|
178
|
-
var
|
|
179
|
-
return { name:
|
|
180
|
-
var
|
|
181
|
-
Object[
|
|
182
|
-
} }], leastHiprintVersion:
|
|
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
|
-
|
|
187
|
+
F as default
|
|
186
188
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(function(
|
|
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: `,
|
|
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(
|
|
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(
|
|
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
|
|
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
|
-
"
|
|
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
|
-
"
|
|
44
|
+
"@zumer/snapdom": "^2.0.1"
|
|
45
45
|
}
|
|
46
46
|
}
|