element-to-pdf
Advanced tools
Comparing version 1.0.7 to 1.0.9
@@ -8,3 +8,3 @@ import jspdf from 'jspdf'; | ||
export declare const A5Size: PDFSize; | ||
declare type ExtraRenderFunction = (pdf: jspdf, currentPage: number) => void; | ||
declare type ExtraRenderFunction = (pdf: jspdf, currentPage: number, totalPage: number) => void; | ||
declare type PDFPadding = [top: number, right: number, bottom: number, left: number]; | ||
@@ -11,0 +11,0 @@ declare type TransformPDFRes = { |
@@ -63,3 +63,3 @@ var __assign = (this && this.__assign) || function () { | ||
* @LastEditors: wang0122xl@163.com | ||
* @LastEditTime: 2022-05-26 15:00:01 | ||
* @LastEditTime: 2022-06-29 14:37:14 | ||
* @Description: file content | ||
@@ -229,3 +229,2 @@ */ | ||
var src = canvas.toDataURL('image/jpeg', 1); | ||
console.log(props); | ||
props.pdf.addImage(src, 'JPEG', props.left, props.top, props.width, props.height); | ||
@@ -299,2 +298,11 @@ }); | ||
} | ||
function renderHeaderFooter(currentPage, totalPage) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
renderPageHeader === null || renderPageHeader === void 0 ? void 0 : renderPageHeader(pdf, currentPage, totalPage); | ||
renderPageFooter === null || renderPageFooter === void 0 ? void 0 : renderPageFooter(pdf, currentPage, totalPage); | ||
return [2 /*return*/]; | ||
}); | ||
}); | ||
} | ||
function createNewPage(self, inTable, currentEle) { | ||
@@ -315,4 +323,3 @@ if (lastElementAsFooter) { | ||
initializePage(); | ||
renderPageHeader === null || renderPageHeader === void 0 ? void 0 : renderPageHeader(pdf, currentPage); | ||
renderPageFooter === null || renderPageFooter === void 0 ? void 0 : renderPageFooter(pdf, currentPage); | ||
// promises.push(renderHeaderFooter(currentPage)) | ||
if (firstElementAsHeader) { | ||
@@ -399,3 +406,3 @@ promises.push(self.pdfAddEle({ | ||
} | ||
var self, _a, isSeperatorCallback, _b, isPdfTableCallback, _c, lastElementOnBottom, _d, firstElementAsHeader, _e, lastElementAsFooter, element, _f, size, _g, padding, renderPageHeader, renderPageFooter, _h, stickyTableHeader, _j, startPage, pdfWidth, parentRect, top, left, childrenElements, firstEle, secondEle, lastEle, lastSecondEle, _k, firstEleY, firstEleHeight, _l, lastEleY, lastEleHeight, _m, secondEleY, secondEleHeight, _o, lastSecondEleY, lastSecondEleHeight, lastOffsetY, firstOffsetY, currentPage, pdf, promises, lastEleAsFooterY, i, childEle; | ||
var self, _a, isSeperatorCallback, _b, isPdfTableCallback, _c, lastElementOnBottom, _d, firstElementAsHeader, _e, lastElementAsFooter, element, _f, size, _g, padding, renderPageHeader, renderPageFooter, _h, stickyTableHeader, _j, startPage, pdfWidth, parentRect, top, left, childrenElements, firstEle, secondEle, lastEle, lastSecondEle, _k, firstEleY, firstEleHeight, _l, lastEleY, lastEleHeight, _m, secondEleY, secondEleHeight, _o, lastSecondEleY, lastSecondEleHeight, lastOffsetY, firstOffsetY, currentPage, pdf, promises, lastEleAsFooterY, i, childEle, i; | ||
return __generator(this, function (_p) { | ||
@@ -436,4 +443,2 @@ switch (_p.label) { | ||
lastEleAsFooterY = size.height - padding[2] - lastEleHeight; | ||
renderPageHeader === null || renderPageHeader === void 0 ? void 0 : renderPageHeader(pdf, 1); | ||
renderPageFooter === null || renderPageFooter === void 0 ? void 0 : renderPageFooter(pdf, 1); | ||
for (i = 0; i < childrenElements.length; i++) { | ||
@@ -446,2 +451,6 @@ childEle = element.children[i]; | ||
_p.sent(); | ||
for (i = 0; i < currentPage; i++) { | ||
pdf.setPage(i + 1 + startPage); | ||
renderHeaderFooter(i + 1, currentPage); | ||
} | ||
props.element.classList.remove(DomToPdf.TransformingClassName); | ||
@@ -448,0 +457,0 @@ return [2 /*return*/, { |
{ | ||
"name": "element-to-pdf", | ||
"private": false, | ||
"version": "1.0.7", | ||
"version": "1.0.9", | ||
"homepage": "https://wang0122xl.github.io/dom-to-pdf/", | ||
@@ -23,3 +23,4 @@ "main": "libs/index.js", | ||
"author": { | ||
"name": "fe_jason" | ||
"name": "fe_jason", | ||
"email": "wang0122xl@163.com" | ||
}, | ||
@@ -26,0 +27,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4050717
597