ztxkutils 2.7.15 → 2.7.16
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 +2 -1
- package/dist/print.js +7 -3
- package/package.json +1 -1
package/dist/print.d.ts
CHANGED
@@ -21,11 +21,12 @@ interface IParams {
|
|
21
21
|
hiddenClassNames?: string[];
|
22
22
|
}
|
23
23
|
export declare function printCurrentDom({ hiddenClassNames }?: IParams): void;
|
24
|
-
export declare function htmlToPdf({ pageClassName, dom, pdfName, isShowPage, }: {
|
24
|
+
export declare function htmlToPdf({ pageClassName, dom, pdfName, isShowPage, noDownload, }: {
|
25
25
|
pageClassName?: string;
|
26
26
|
dom: HTMLElement;
|
27
27
|
pdfName: string;
|
28
28
|
isShowPage?: boolean;
|
29
|
+
noDownload?: boolean;
|
29
30
|
}): Promise<{
|
30
31
|
pdf: jsPDF;
|
31
32
|
pdfBase64: any[];
|
package/dist/print.js
CHANGED
@@ -102,7 +102,7 @@ function createPdf(canvas, pdf) {
|
|
102
102
|
}
|
103
103
|
}
|
104
104
|
function htmlToPdf(_a) {
|
105
|
-
var pageClassName = _a.pageClassName, dom = _a.dom, pdfName = _a.pdfName, isShowPage = _a.isShowPage;
|
105
|
+
var pageClassName = _a.pageClassName, dom = _a.dom, pdfName = _a.pdfName, isShowPage = _a.isShowPage, noDownload = _a.noDownload;
|
106
106
|
var pdf = new jsPDF(undefined, 'pt', 'a4');
|
107
107
|
var allDom = document.querySelectorAll(pageClassName ? pageClassName : '.html2canvas-container-page');
|
108
108
|
if (allDom.length > 0 && isShowPage) {
|
@@ -135,7 +135,9 @@ function htmlToPdf(_a) {
|
|
135
135
|
_i++;
|
136
136
|
return [3 /*break*/, 1];
|
137
137
|
case 4:
|
138
|
-
|
138
|
+
if (!noDownload) {
|
139
|
+
pdf.save(pdfName + ".pdf");
|
140
|
+
}
|
139
141
|
return [2 /*return*/, Promise.resolve({
|
140
142
|
pdf: pdf,
|
141
143
|
pdfBase64: pdfBase64_1,
|
@@ -148,7 +150,9 @@ function htmlToPdf(_a) {
|
|
148
150
|
else {
|
149
151
|
return html2canvas(dom).then(function (canvas) {
|
150
152
|
createPdf(canvas, pdf);
|
151
|
-
|
153
|
+
if (!noDownload) {
|
154
|
+
pdf.save(pdfName + ".pdf");
|
155
|
+
}
|
152
156
|
return {
|
153
157
|
pdf: pdf,
|
154
158
|
pdfBase64: pdf.output('dataurlstring'),
|