@sv-print/plugin-api-pdf3 0.1.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.
@@ -0,0 +1,2 @@
1
+ import type { PluginOptions } from "sv-print";
2
+ export default function plugin(options?: any): PluginOptions;
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var C=(n,r,t)=>new Promise((e,i)=>{var s=f=>{try{u(t.next(f))}catch(h){i(h)}},m=f=>{try{u(t.throw(f))}catch(h){i(h)}},u=f=>f.done?e(f.value):Promise.resolve(f.value).then(s,m);u((t=t.apply(n,r)).next())});const B=require("html-to-image"),J=require("jspdf");function L(n){if(n&&n.__esModule)return n;const r=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(r,t,e.get?e:{enumerable:!0,get:()=>n[t]})}}return r.default=n,Object.freeze(r)}const A=L(B);(function(n,r){for(var t=v,e=n();[];)try{var i=parseInt(t(233))/1+-parseInt(t(221))/2*(parseInt(t(278))/3)+parseInt(t(274))/4*(parseInt(t(264))/5)+-parseInt(t(243))/6+parseInt(t(280))/7+parseInt(t(228))/8+parseInt(t(258))/9;if(i===r)break;e.push(e.shift())}catch(s){e.push(e.shift())}})(T,517966);function T(){var n=["isDownload","12714858lfpnKJ",".hiprint-printPanel .hiprint-printPaper","toDataURL","each","total","svg","85sJIbhk","indexOf","#fff","toPt","imageSmoothingEnabled","jpeg","hinnn","createTempContainer","quality","base64","14588Ibgono","floor","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","tagName","2786379bVxEZY","toLocaleLowerCase","1852186kuXXEl","width","svg2canvas","loadAllImages","promise","webp","\u81EA\u5B9A\u4E49","clear","IMG","output","bmp","cur","2mzrjjJ","error","removeTempContainer","resolve","portrait","toCanvas","getHtml","3437224ITLwAD","position:fixed","then","JPEG","height","309972jzKDnQ","image/jpeg","addPage","landscape","src","jpg","includes","printPanels","queue","pop","6193350IlRSoO","add","save",".pdf","find","baseURI","paperType","length","png","split","addImage","log","css","onProgress"];return T=function(){return n},T()}function v(n,r){var t=T();return v=function(e,i){e=e-221;var s=t[e];return s},v(n,r)}const E=function(n,r,t){return C(this,null,function*(){var e=v,i=this,s=globalThis.$.Deferred(),m=!![];let u=(c,I)=>{var l=v;const a=Math[l(275)](c/I*100);console.log(l(291),c,l(262),I),console[l(254)]("toPdf percent: ",a+"%")};if(this.printPanels[e(250)]){var f=globalThis.hinnn.mm.toPt(this[e(240)][0][e(281)]),h=globalThis[e(270)].mm[e(267)](this[e(240)][0][e(232)]),y=globalThis.$.extend({filter:a=>{var x=e;return a[x(277)]!=x(288)||a.tagName==x(288)&&([x(238),x(269),x(251),"gif",x(290),x(285),x(263)][x(239)](a[x(237)][x(252)](".")[x(242)]().toLowerCase())||a[x(237)]!=a[x(248)]||a[x(237)][x(265)]("http")>-1&&a[x(237)]!=a.baseURI||a.src[x(265)](x(273))>-1)},backgroundColor:e(266)},t||{});const c=this[e(240)][0][e(249)],I=c!=null&&c!=""&&c!=e(286);var b=new J.jsPDF({orientation:this.getOrient(0)==1?e(225):e(236),unit:"pt",format:I?c[e(279)]():[f,h]}),g=yield this[e(227)](n,t);t&&t[e(257)]!=null&&(m=t[e(257)]),t&&t.onProgress!=null&&(u=t[e(256)]),globalThis.$(g).css("width","")[e(255)]("height",""),this[e(271)]();var O=this.getTempContainer();this[e(282)](g,y),O.html(g[0]);let l=O.find(e(259))[e(250)];globalThis.$(g).css(e(229)),this[e(283)](g,function(){var a=e;try{O[a(247)](a(259))[a(261)](function(x,_){var d=a;globalThis[d(270)][d(241)][d(244)](function(k){var o=d;A[o(226)](_,y)[o(230)](function(P){var p=o,q=P.getContext("2d");q[p(268)]=![];var D=P[p(260)](p(234),y[p(272)]||.92);b[p(253)](D,p(231),0,0,f,h),x<l-1&&b[p(235)](),u(x+1,l),k()})}),x==l-1&&(globalThis.hinnn[d(241)][d(244)](function(k){var o=d;if(m)i[o(223)](),r.indexOf(o(246))>-1?b[o(245)](r):b[o(245)](r+".pdf");else{i.removeTempContainer();let P=t.type||"blob",p=b[o(289)](P);s[o(224)](p)}globalThis[o(270)].queue[o(287)]()}),globalThis[d(270)][d(241)].run())})}catch(x){console[a(222)](a(276)),console[a(254)](x)}})}return s[e(284)]()})};(function(n,r){for(var t=w,e=n();[];)try{var i=parseInt(t(217))/1+-parseInt(t(213))/2*(parseInt(t(220))/3)+-parseInt(t(214))/4*(parseInt(t(219))/5)+parseInt(t(212))/6*(-parseInt(t(223))/7)+-parseInt(t(221))/8*(parseInt(t(225))/9)+-parseInt(t(222))/10+-parseInt(t(226))/11*(-parseInt(t(216))/12);if(i===r)break;e.push(e.shift())}catch(s){e.push(e.shift())}})(j,475391);function w(n,r){var t=j();return w=function(e,i){e=e-211;var s=t[e];return s},w(n,r)}function j(){var n=["174Tgvzoi","579844limXwe","4tJriqD","add toPdf Api to PrintTemplate","36kFAdlT","375328ZBxxNJ","0.3.0","2465635ybkoCe","9KgIpfd","4290344BbEtgU","5136170pwqULG","128331OqYBet","add toPdf Api","9BmBXMB","11163251rBiZlu","defineProperty"];return j=function(){return n},j()}function M(n){var r=w;return{name:r(224),description:r(224),hooks:[{hook:"newPrintTemplate",name:r(215),description:r(215),priority:1,run:({template:t,options:e})=>{var i=r;Object[i(211)](t,"toPdf",{value:E,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:r(218)}}module.exports=M;
package/dist/index.mjs ADDED
@@ -0,0 +1,130 @@
1
+ var B = (a, n, x) => new Promise((e, i) => {
2
+ var s = (d) => {
3
+ try {
4
+ h(x.next(d));
5
+ } catch (u) {
6
+ i(u);
7
+ }
8
+ }, m = (d) => {
9
+ try {
10
+ h(x.throw(d));
11
+ } catch (u) {
12
+ i(u);
13
+ }
14
+ }, h = (d) => d.done ? e(d.value) : Promise.resolve(d.value).then(s, m);
15
+ h((x = x.apply(a, n)).next());
16
+ });
17
+ import * as L from "html-to-image";
18
+ import { jsPDF as O } from "jspdf";
19
+ (function(a, n) {
20
+ for (var x = v, e = a(); []; )
21
+ try {
22
+ var i = parseInt(x(233)) / 1 + -parseInt(x(221)) / 2 * (parseInt(x(278)) / 3) + parseInt(x(274)) / 4 * (parseInt(x(264)) / 5) + -parseInt(x(243)) / 6 + parseInt(x(280)) / 7 + parseInt(x(228)) / 8 + parseInt(x(258)) / 9;
23
+ if (i === n)
24
+ break;
25
+ e.push(e.shift());
26
+ } catch (s) {
27
+ e.push(e.shift());
28
+ }
29
+ })(T, 517966);
30
+ function T() {
31
+ var a = ["isDownload", "12714858lfpnKJ", ".hiprint-printPanel .hiprint-printPaper", "toDataURL", "each", "total", "svg", "85sJIbhk", "indexOf", "#fff", "toPt", "imageSmoothingEnabled", "jpeg", "hinnn", "createTempContainer", "quality", "base64", "14588Ibgono", "floor", "toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "tagName", "2786379bVxEZY", "toLocaleLowerCase", "1852186kuXXEl", "width", "svg2canvas", "loadAllImages", "promise", "webp", "\u81EA\u5B9A\u4E49", "clear", "IMG", "output", "bmp", "cur", "2mzrjjJ", "error", "removeTempContainer", "resolve", "portrait", "toCanvas", "getHtml", "3437224ITLwAD", "position:fixed", "then", "JPEG", "height", "309972jzKDnQ", "image/jpeg", "addPage", "landscape", "src", "jpg", "includes", "printPanels", "queue", "pop", "6193350IlRSoO", "add", "save", ".pdf", "find", "baseURI", "paperType", "length", "png", "split", "addImage", "log", "css", "onProgress"];
32
+ return T = function() {
33
+ return a;
34
+ }, T();
35
+ }
36
+ function v(a, n) {
37
+ var x = T();
38
+ return v = function(e, i) {
39
+ e = e - 221;
40
+ var s = x[e];
41
+ return s;
42
+ }, v(a, n);
43
+ }
44
+ const A = function(a, n, x) {
45
+ return B(this, null, function* () {
46
+ var e = v, i = this, s = globalThis.$.Deferred(), m = !![];
47
+ let h = (c, I) => {
48
+ var l = v;
49
+ const r = Math[l(275)](c / I * 100);
50
+ console.log(l(291), c, l(262), I), console[l(254)]("toPdf percent: ", r + "%");
51
+ };
52
+ if (this.printPanels[e(250)]) {
53
+ var d = globalThis.hinnn.mm.toPt(this[e(240)][0][e(281)]), u = globalThis[e(270)].mm[e(267)](this[e(240)][0][e(232)]), C = globalThis.$.extend({ filter: (r) => {
54
+ var t = e;
55
+ return r[t(277)] != t(288) || r.tagName == t(288) && ([t(238), t(269), t(251), "gif", t(290), t(285), t(263)][t(239)](r[t(237)][t(252)](".")[t(242)]().toLowerCase()) || r[t(237)] != r[t(248)] || r[t(237)][t(265)]("http") > -1 && r[t(237)] != r.baseURI || r.src[t(265)](t(273)) > -1);
56
+ }, backgroundColor: e(266) }, x || {});
57
+ const c = this[e(240)][0][e(249)], I = c != null && c != "" && c != e(286);
58
+ var b = new O({ orientation: this.getOrient(0) == 1 ? e(225) : e(236), unit: "pt", format: I ? c[e(279)]() : [d, u] }), g = yield this[e(227)](a, x);
59
+ x && x[e(257)] != null && (m = x[e(257)]), x && x.onProgress != null && (h = x[e(256)]), globalThis.$(g).css("width", "")[e(255)]("height", ""), this[e(271)]();
60
+ var k = this.getTempContainer();
61
+ this[e(282)](g, C), k.html(g[0]);
62
+ let l = k.find(e(259))[e(250)];
63
+ globalThis.$(g).css(e(229)), this[e(283)](g, function() {
64
+ var r = e;
65
+ try {
66
+ k[r(247)](r(259))[r(261)](function(t, D) {
67
+ var f = r;
68
+ globalThis[f(270)][f(241)][f(244)](function(j) {
69
+ var o = f;
70
+ L[o(226)](D, C)[o(230)](function(P) {
71
+ var p = o, q = P.getContext("2d");
72
+ q[p(268)] = ![];
73
+ var J = P[p(260)](p(234), C[p(272)] || 0.92);
74
+ b[p(253)](J, p(231), 0, 0, d, u), t < l - 1 && b[p(235)](), h(t + 1, l), j();
75
+ });
76
+ }), t == l - 1 && (globalThis.hinnn[f(241)][f(244)](function(j) {
77
+ var o = f;
78
+ if (m)
79
+ i[o(223)](), n.indexOf(o(246)) > -1 ? b[o(245)](n) : b[o(245)](n + ".pdf");
80
+ else {
81
+ i.removeTempContainer();
82
+ let P = x.type || "blob", p = b[o(289)](P);
83
+ s[o(224)](p);
84
+ }
85
+ globalThis[o(270)].queue[o(287)]();
86
+ }), globalThis[f(270)][f(241)].run());
87
+ });
88
+ } catch (t) {
89
+ console[r(222)](r(276)), console[r(254)](t);
90
+ }
91
+ });
92
+ }
93
+ return s[e(284)]();
94
+ });
95
+ };
96
+ (function(a, n) {
97
+ for (var x = w, e = a(); []; )
98
+ try {
99
+ var i = parseInt(x(217)) / 1 + -parseInt(x(213)) / 2 * (parseInt(x(220)) / 3) + -parseInt(x(214)) / 4 * (parseInt(x(219)) / 5) + parseInt(x(212)) / 6 * (-parseInt(x(223)) / 7) + -parseInt(x(221)) / 8 * (parseInt(x(225)) / 9) + -parseInt(x(222)) / 10 + -parseInt(x(226)) / 11 * (-parseInt(x(216)) / 12);
100
+ if (i === n)
101
+ break;
102
+ e.push(e.shift());
103
+ } catch (s) {
104
+ e.push(e.shift());
105
+ }
106
+ })(y, 475391);
107
+ function w(a, n) {
108
+ var x = y();
109
+ return w = function(e, i) {
110
+ e = e - 211;
111
+ var s = x[e];
112
+ return s;
113
+ }, w(a, n);
114
+ }
115
+ function y() {
116
+ var a = ["174Tgvzoi", "579844limXwe", "4tJriqD", "add toPdf Api to PrintTemplate", "36kFAdlT", "375328ZBxxNJ", "0.3.0", "2465635ybkoCe", "9KgIpfd", "4290344BbEtgU", "5136170pwqULG", "128331OqYBet", "add toPdf Api", "9BmBXMB", "11163251rBiZlu", "defineProperty"];
117
+ return y = function() {
118
+ return a;
119
+ }, y();
120
+ }
121
+ function R(a) {
122
+ var n = w;
123
+ return { name: n(224), description: n(224), hooks: [{ hook: "newPrintTemplate", name: n(215), description: n(215), priority: 1, run: ({ template: x, options: e }) => {
124
+ var i = n;
125
+ Object[i(211)](x, "toPdf", { value: A, enumerable: ![], writable: !![], configurable: !![] });
126
+ } }], leastHiprintVersion: n(218) };
127
+ }
128
+ export {
129
+ R as default
130
+ };
@@ -0,0 +1 @@
1
+ (function(f,h){typeof exports=="object"&&typeof module!="undefined"?module.exports=h(require("html-to-image"),require("jspdf")):typeof define=="function"&&define.amd?define(["html-to-image","jspdf"],h):(f=typeof globalThis!="undefined"?globalThis:f||self,f.pluginApiPdf=h(f.htmlToImage,f.jspdf))})(this,function(f,h){"use strict";var J=(f,h,v)=>new Promise((y,b)=>{var g=o=>{try{l(v.next(o))}catch(I){b(I)}},O=o=>{try{l(v.throw(o))}catch(I){b(I)}},l=o=>o.done?y(o.value):Promise.resolve(o.value).then(g,O);l((v=v.apply(f,h)).next())});function v(x){if(x&&x.__esModule)return x;const r=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(r,t,e.get?e:{enumerable:!0,get:()=>x[t]})}}return r.default=x,Object.freeze(r)}const y=v(f);(function(x,r){for(var t=g,e=x();[];)try{var s=parseInt(t(233))/1+-parseInt(t(221))/2*(parseInt(t(278))/3)+parseInt(t(274))/4*(parseInt(t(264))/5)+-parseInt(t(243))/6+parseInt(t(280))/7+parseInt(t(228))/8+parseInt(t(258))/9;if(s===r)break;e.push(e.shift())}catch(c){e.push(e.shift())}})(b,517966);function b(){var x=["isDownload","12714858lfpnKJ",".hiprint-printPanel .hiprint-printPaper","toDataURL","each","total","svg","85sJIbhk","indexOf","#fff","toPt","imageSmoothingEnabled","jpeg","hinnn","createTempContainer","quality","base64","14588Ibgono","floor","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","tagName","2786379bVxEZY","toLocaleLowerCase","1852186kuXXEl","width","svg2canvas","loadAllImages","promise","webp","\u81EA\u5B9A\u4E49","clear","IMG","output","bmp","cur","2mzrjjJ","error","removeTempContainer","resolve","portrait","toCanvas","getHtml","3437224ITLwAD","position:fixed","then","JPEG","height","309972jzKDnQ","image/jpeg","addPage","landscape","src","jpg","includes","printPanels","queue","pop","6193350IlRSoO","add","save",".pdf","find","baseURI","paperType","length","png","split","addImage","log","css","onProgress"];return b=function(){return x},b()}function g(x,r){var t=b();return g=function(e,s){e=e-221;var c=t[e];return c},g(x,r)}const O=function(x,r,t){return J(this,null,function*(){var e=g,s=this,c=globalThis.$.Deferred(),_=!![];let q=(m,j)=>{var u=g;const i=Math[u(275)](m/j*100);console.log(u(291),m,u(262),j),console[u(254)]("toPdf percent: ",i+"%")};if(this.printPanels[e(250)]){var D=globalThis.hinnn.mm.toPt(this[e(240)][0][e(281)]),B=globalThis[e(270)].mm[e(267)](this[e(240)][0][e(232)]),k=globalThis.$.extend({filter:i=>{var n=e;return i[n(277)]!=n(288)||i.tagName==n(288)&&([n(238),n(269),n(251),"gif",n(290),n(285),n(263)][n(239)](i[n(237)][n(252)](".")[n(242)]().toLowerCase())||i[n(237)]!=i[n(248)]||i[n(237)][n(265)]("http")>-1&&i[n(237)]!=i.baseURI||i.src[n(265)](n(273))>-1)},backgroundColor:e(266)},t||{});const m=this[e(240)][0][e(249)],j=m!=null&&m!=""&&m!=e(286);var T=new h.jsPDF({orientation:this.getOrient(0)==1?e(225):e(236),unit:"pt",format:j?m[e(279)]():[D,B]}),P=yield this[e(227)](x,t);t&&t[e(257)]!=null&&(_=t[e(257)]),t&&t.onProgress!=null&&(q=t[e(256)]),globalThis.$(P).css("width","")[e(255)]("height",""),this[e(271)]();var C=this.getTempContainer();this[e(282)](P,k),C.html(P[0]);let u=C.find(e(259))[e(250)];globalThis.$(P).css(e(229)),this[e(283)](P,function(){var i=e;try{C[i(247)](i(259))[i(261)](function(n,L){var d=i;globalThis[d(270)][d(241)][d(244)](function(A){var a=d;y[a(226)](L,k)[a(230)](function(w){var p=a,E=w.getContext("2d");E[p(268)]=![];var M=w[p(260)](p(234),k[p(272)]||.92);T[p(253)](M,p(231),0,0,D,B),n<u-1&&T[p(235)](),q(n+1,u),A()})}),n==u-1&&(globalThis.hinnn[d(241)][d(244)](function(A){var a=d;if(_)s[a(223)](),r.indexOf(a(246))>-1?T[a(245)](r):T[a(245)](r+".pdf");else{s.removeTempContainer();let w=t.type||"blob",p=T[a(289)](w);c[a(224)](p)}globalThis[a(270)].queue[a(287)]()}),globalThis[d(270)][d(241)].run())})}catch(n){console[i(222)](i(276)),console[i(254)](n)}})}return c[e(284)]()})};(function(x,r){for(var t=l,e=x();[];)try{var s=parseInt(t(217))/1+-parseInt(t(213))/2*(parseInt(t(220))/3)+-parseInt(t(214))/4*(parseInt(t(219))/5)+parseInt(t(212))/6*(-parseInt(t(223))/7)+-parseInt(t(221))/8*(parseInt(t(225))/9)+-parseInt(t(222))/10+-parseInt(t(226))/11*(-parseInt(t(216))/12);if(s===r)break;e.push(e.shift())}catch(c){e.push(e.shift())}})(o,475391);function l(x,r){var t=o();return l=function(e,s){e=e-211;var c=t[e];return c},l(x,r)}function o(){var x=["174Tgvzoi","579844limXwe","4tJriqD","add toPdf Api to PrintTemplate","36kFAdlT","375328ZBxxNJ","0.3.0","2465635ybkoCe","9KgIpfd","4290344BbEtgU","5136170pwqULG","128331OqYBet","add toPdf Api","9BmBXMB","11163251rBiZlu","defineProperty"];return o=function(){return x},o()}function I(x){var r=l;return{name:r(224),description:r(224),hooks:[{hook:"newPrintTemplate",name:r(215),description:r(215),priority:1,run:({template:t,options:e})=>{var s=r;Object[s(211)](t,"toPdf",{value:O,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:r(218)}}return I});
@@ -0,0 +1,2 @@
1
+ declare const toPdf: (t: any, e: any, options: any) => Promise<any>;
2
+ export { toPdf };
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@sv-print/plugin-api-pdf3",
3
+ "version": "0.1.0",
4
+ "description": "add pdf api to print template",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "svelte": "./dist/index.mjs",
8
+ "jsdelivr": "./dist/index.umd.js",
9
+ "unpkg": "./dist/index.umd.js",
10
+ "module": "./dist/index.mjs",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.mjs",
16
+ "require": "./dist/index.umd.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "build": "vite build && tsc src/index.ts --declaration --emitDeclarationOnly --outDir dist",
24
+ "build-browserify": "vite build --mode=browserify",
25
+ "pub": "pnpm build && npm --registry https://registry.npmjs.org/ publish --access public",
26
+ "pub-beta": "pnpm build && npm --registry https://registry.npmjs.org/ publish --access public --tag beta"
27
+ },
28
+ "keywords": [
29
+ "sv-print",
30
+ "hiprint"
31
+ ],
32
+ "author": "",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "sv-print": "^0.2.0",
36
+ "jspdf": "^3.0.2",
37
+ "html-to-image": "^1.11.13"
38
+ },
39
+ "devDependencies": {
40
+ "vite-plugin-javascript-obfuscator": "^3.1.0"
41
+ },
42
+ "peerDependencies": {
43
+ "sv-print": "^0.2.0",
44
+ "html-to-image": "^1.11.13"
45
+ }
46
+ }