@driveflux/frontend-pdf 2.0.3-next.0 → 2.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.
- package/dist/pdf.js +6 -4
- package/package.json +10 -10
package/dist/pdf.js
CHANGED
|
@@ -146,7 +146,7 @@ function _ts_generator(thisArg, body) {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
import
|
|
149
|
+
import html2canvasPro from 'html2canvas-pro';
|
|
150
150
|
import jsPDF from 'jspdf';
|
|
151
151
|
/**
|
|
152
152
|
*
|
|
@@ -227,6 +227,7 @@ var generatePdf = function(elements, options) {
|
|
|
227
227
|
element = elements[i];
|
|
228
228
|
// set width to container
|
|
229
229
|
originalWidth = element.style.width;
|
|
230
|
+
// const originalHeight = element.style.height
|
|
230
231
|
element.style.width = (options === null || options === void 0 ? void 0 : options.orientation) === 'l' || (options === null || options === void 0 ? void 0 : options.orientation) === 'landscape' ? '1263px' : '892.5px';
|
|
231
232
|
element.style.height = (options === null || options === void 0 ? void 0 : options.orientation) === 'l' || (options === null || options === void 0 ? void 0 : options.orientation) === 'landscape' ? '892.5px' : '1263px';
|
|
232
233
|
// workaround to remove canvas extra space to div
|
|
@@ -235,18 +236,19 @@ var generatePdf = function(elements, options) {
|
|
|
235
236
|
(_style_sheet = style.sheet) === null || _style_sheet === void 0 ? void 0 : _style_sheet.insertRule('body > div:last-child img { display: inline-block; }');
|
|
236
237
|
return [
|
|
237
238
|
4,
|
|
238
|
-
|
|
239
|
+
html2canvasPro(element, {
|
|
239
240
|
scale: 3.0
|
|
240
241
|
})
|
|
241
242
|
];
|
|
242
243
|
case 2:
|
|
243
244
|
canvas = _state.sent();
|
|
244
|
-
data = canvas.toDataURL('image/
|
|
245
|
+
data = canvas.toDataURL('image/jpeg');
|
|
245
246
|
imgProperties = pdf.getImageProperties(data);
|
|
246
247
|
pdfWidth = pdf.internal.pageSize.getWidth();
|
|
247
248
|
pdfHeight = imgProperties.height * pdfWidth / imgProperties.width;
|
|
248
|
-
pdf.addImage(data, 'PNG', 0, 0, pdfWidth, pdfHeight
|
|
249
|
+
pdf.addImage(data, 'PNG', 0, 0, pdfWidth, pdfHeight);
|
|
249
250
|
element.style.width = originalWidth;
|
|
251
|
+
// element.style.height = originalHeight
|
|
250
252
|
if (elements.length > 1 && i < elements.length - 1) {
|
|
251
253
|
pdf.addPage();
|
|
252
254
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driveflux/frontend-pdf",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -12,18 +12,18 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"html2canvas": "^1.
|
|
16
|
-
"jspdf": "^3.0.
|
|
15
|
+
"html2canvas-pro": "^1.5.12",
|
|
16
|
+
"jspdf": "^3.0.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@driveflux/fab": "3.0.
|
|
20
|
-
"@driveflux/tsconfig": "2.0.
|
|
21
|
-
"@swc/cli": "
|
|
22
|
-
"@swc/core": "
|
|
23
|
-
"@types/lodash": "^4.17.
|
|
24
|
-
"@types/node": "^
|
|
19
|
+
"@driveflux/fab": "3.0.2",
|
|
20
|
+
"@driveflux/tsconfig": "2.0.2",
|
|
21
|
+
"@swc/cli": "0.7.5",
|
|
22
|
+
"@swc/core": "1.11.24",
|
|
23
|
+
"@types/lodash": "^4.17.16",
|
|
24
|
+
"@types/node": "^22.15.16",
|
|
25
25
|
"del-cli": "^6.0.0",
|
|
26
|
-
"typescript": "^5.
|
|
26
|
+
"typescript": "^5.8.3"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "fab",
|