ztxkutils 2.7.14 → 2.7.15

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/print.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @author 陈亚雄
3
+ * @description 打印相关方法
4
+ */
5
+ import { jsPDF } from 'jspdf';
1
6
  /**
2
7
  * 添加水印
3
8
  */
@@ -21,5 +26,11 @@ export declare function htmlToPdf({ pageClassName, dom, pdfName, isShowPage, }:
21
26
  dom: HTMLElement;
22
27
  pdfName: string;
23
28
  isShowPage?: boolean;
24
- }): Promise<void>;
29
+ }): Promise<{
30
+ pdf: jsPDF;
31
+ pdfBase64: any[];
32
+ }> | Promise<{
33
+ pdf: jsPDF;
34
+ pdfBase64: string;
35
+ }>;
25
36
  export {};
package/dist/print.js CHANGED
@@ -108,6 +108,7 @@ function htmlToPdf(_a) {
108
108
  if (allDom.length > 0 && isShowPage) {
109
109
  var allDomArray = Array.prototype.slice.call(allDom);
110
110
  var promiseAllDomArray_1 = allDomArray.map(function (dom) { return html2canvas(dom); });
111
+ var pdfBase64_1 = [];
111
112
  return (function () {
112
113
  return __awaiter(this, void 0, void 0, function () {
113
114
  var i, _i, promiseAllDomArray_2, item, canvas;
@@ -128,13 +129,17 @@ function htmlToPdf(_a) {
128
129
  if (i < promiseAllDomArray_1.length) {
129
130
  pdf.addPage();
130
131
  }
132
+ pdfBase64_1.push(pdf.output('dataurlstring'));
131
133
  _a.label = 3;
132
134
  case 3:
133
135
  _i++;
134
136
  return [3 /*break*/, 1];
135
137
  case 4:
136
138
  pdf.save(pdfName + ".pdf");
137
- return [2 /*return*/, Promise.resolve()];
139
+ return [2 /*return*/, Promise.resolve({
140
+ pdf: pdf,
141
+ pdfBase64: pdfBase64_1,
142
+ })];
138
143
  }
139
144
  });
140
145
  });
@@ -144,6 +149,10 @@ function htmlToPdf(_a) {
144
149
  return html2canvas(dom).then(function (canvas) {
145
150
  createPdf(canvas, pdf);
146
151
  pdf.save(pdfName + ".pdf");
152
+ return {
153
+ pdf: pdf,
154
+ pdfBase64: pdf.output('dataurlstring'),
155
+ };
147
156
  });
148
157
  }
149
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkutils",
3
- "version": "2.7.14",
3
+ "version": "2.7.15",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",