pdfmake 0.2.15 → 0.2.17
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/CHANGELOG.md +10 -0
- package/build/pdfmake.js +51985 -51712
- package/build/pdfmake.js.map +1 -1
- package/build/pdfmake.min.js +2 -2
- package/build/pdfmake.min.js.map +1 -1
- package/package.json +2 -2
- package/src/3rd-party/svg-to-pdfkit/LICENSE +9 -9
- package/src/imageMeasure.js +10 -1
- package/src/layoutBuilder.js +29 -25
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/pdfmake.iml +0 -11
- package/.idea/vcs.xml +0 -6
- package/eslint.config.mjs +0 -52
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfmake",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"description": "Client/server side PDF printing in pure JavaScript",
|
|
5
5
|
"main": "src/printer.js",
|
|
6
6
|
"browser": "build/pdfmake.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@foliojs-fork/linebreak": "^1.1.2",
|
|
12
|
-
"@foliojs-fork/pdfkit": "^0.15.
|
|
12
|
+
"@foliojs-fork/pdfkit": "^0.15.2",
|
|
13
13
|
"iconv-lite": "^0.6.3",
|
|
14
14
|
"xmldoc": "^1.3.0"
|
|
15
15
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 SVG-to-PDFKit contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 SVG-to-PDFKit contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/src/imageMeasure.js
CHANGED
|
@@ -26,7 +26,16 @@ ImageMeasure.prototype.measureImage = function (src) {
|
|
|
26
26
|
image = this.pdfKitDoc._imageRegistry[src];
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
var imageSize = { width: image.width, height: image.height };
|
|
30
|
+
|
|
31
|
+
if (typeof image === 'object' && image.constructor.name === 'JPEG') {
|
|
32
|
+
// If EXIF orientation calls for it, swap width and height
|
|
33
|
+
if (image.orientation > 4) {
|
|
34
|
+
imageSize = { width: image.height, height: image.width };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return imageSize;
|
|
30
39
|
|
|
31
40
|
function realImageSrc(src) {
|
|
32
41
|
var img = that.imageDictionary[src];
|
package/src/layoutBuilder.js
CHANGED
|
@@ -252,36 +252,40 @@ LayoutBuilder.prototype.addWatermark = function (watermark, fontProvider, defaul
|
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
watermark.opacity = isNumber(watermark.opacity) ? watermark.opacity : 0.6;
|
|
259
|
-
watermark.bold = watermark.bold || false;
|
|
260
|
-
watermark.italics = watermark.italics || false;
|
|
261
|
-
watermark.angle = !isUndefined(watermark.angle) && !isNull(watermark.angle) ? watermark.angle : null;
|
|
262
|
-
|
|
263
|
-
if (watermark.angle === null) {
|
|
264
|
-
watermark.angle = Math.atan2(this.pageSize.height, this.pageSize.width) * -180 / Math.PI;
|
|
255
|
+
var pages = this.writer.context().pages;
|
|
256
|
+
for (var i = 0, l = pages.length; i < l; i++) {
|
|
257
|
+
pages[i].watermark = getWatermarkObject({ ...watermark }, pages[i].pageSize, fontProvider, defaultStyle);
|
|
265
258
|
}
|
|
266
259
|
|
|
267
|
-
|
|
268
|
-
watermark.
|
|
269
|
-
|
|
260
|
+
function getWatermarkObject(watermark, pageSize, fontProvider, defaultStyle) {
|
|
261
|
+
watermark.font = watermark.font || defaultStyle.font || 'Roboto';
|
|
262
|
+
watermark.fontSize = watermark.fontSize || 'auto';
|
|
263
|
+
watermark.color = watermark.color || 'black';
|
|
264
|
+
watermark.opacity = isNumber(watermark.opacity) ? watermark.opacity : 0.6;
|
|
265
|
+
watermark.bold = watermark.bold || false;
|
|
266
|
+
watermark.italics = watermark.italics || false;
|
|
267
|
+
watermark.angle = !isUndefined(watermark.angle) && !isNull(watermark.angle) ? watermark.angle : null;
|
|
268
|
+
|
|
269
|
+
if (watermark.angle === null) {
|
|
270
|
+
watermark.angle = Math.atan2(pageSize.height, pageSize.width) * -180 / Math.PI;
|
|
271
|
+
}
|
|
270
272
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
fontSize: watermark.fontSize,
|
|
275
|
-
color: watermark.color,
|
|
276
|
-
opacity: watermark.opacity,
|
|
277
|
-
angle: watermark.angle
|
|
278
|
-
};
|
|
273
|
+
if (watermark.fontSize === 'auto') {
|
|
274
|
+
watermark.fontSize = getWatermarkFontSize(pageSize, watermark, fontProvider);
|
|
275
|
+
}
|
|
279
276
|
|
|
280
|
-
|
|
277
|
+
var watermarkObject = {
|
|
278
|
+
text: watermark.text,
|
|
279
|
+
font: fontProvider.provideFont(watermark.font, watermark.bold, watermark.italics),
|
|
280
|
+
fontSize: watermark.fontSize,
|
|
281
|
+
color: watermark.color,
|
|
282
|
+
opacity: watermark.opacity,
|
|
283
|
+
angle: watermark.angle
|
|
284
|
+
};
|
|
281
285
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
286
|
+
watermarkObject._size = getWatermarkSize(watermark, fontProvider);
|
|
287
|
+
|
|
288
|
+
return watermarkObject;
|
|
285
289
|
}
|
|
286
290
|
|
|
287
291
|
function getWatermarkSize(watermark, fontProvider) {
|
package/.idea/misc.xml
DELETED
package/.idea/modules.xml
DELETED
package/.idea/pdfmake.iml
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
|
6
|
-
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
|
7
|
-
</content>
|
|
8
|
-
<orderEntry type="inheritedJdk" />
|
|
9
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
-
</component>
|
|
11
|
-
</module>
|
package/.idea/vcs.xml
DELETED
package/eslint.config.mjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import jsdoc from "eslint-plugin-jsdoc";
|
|
2
|
-
import globals from "globals";
|
|
3
|
-
import js from "@eslint/js";
|
|
4
|
-
|
|
5
|
-
export default [
|
|
6
|
-
{
|
|
7
|
-
ignores: ["src/3rd-party/svg-to-pdfkit/*"],
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
js.configs.recommended,
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
plugins: {
|
|
14
|
-
jsdoc,
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
languageOptions: {
|
|
18
|
-
globals: {
|
|
19
|
-
...globals.browser,
|
|
20
|
-
...globals.node,
|
|
21
|
-
...globals.mocha,
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
ecmaVersion: 9,
|
|
25
|
-
sourceType: "module",
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
rules: {
|
|
29
|
-
semi: 2,
|
|
30
|
-
"no-throw-literal": 2,
|
|
31
|
-
"no-prototype-builtins": 0,
|
|
32
|
-
"jsdoc/check-examples": 0,
|
|
33
|
-
"jsdoc/check-param-names": 1,
|
|
34
|
-
"jsdoc/check-tag-names": 1,
|
|
35
|
-
"jsdoc/check-types": 1,
|
|
36
|
-
"jsdoc/no-undefined-types": 1,
|
|
37
|
-
"jsdoc/require-description": 0,
|
|
38
|
-
"jsdoc/require-description-complete-sentence": 0,
|
|
39
|
-
"jsdoc/require-example": 0,
|
|
40
|
-
"jsdoc/require-hyphen-before-param-description": 0,
|
|
41
|
-
"jsdoc/require-param": 1,
|
|
42
|
-
"jsdoc/require-param-description": 0,
|
|
43
|
-
"jsdoc/require-param-name": 1,
|
|
44
|
-
"jsdoc/require-param-type": 1,
|
|
45
|
-
"jsdoc/require-returns": 1,
|
|
46
|
-
"jsdoc/require-returns-check": 1,
|
|
47
|
-
"jsdoc/require-returns-description": 0,
|
|
48
|
-
"jsdoc/require-returns-type": 1,
|
|
49
|
-
"jsdoc/valid-types": 1,
|
|
50
|
-
},
|
|
51
|
-
}
|
|
52
|
-
];
|