pdfmake 0.3.0-beta.11 → 0.3.0-beta.13
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 +18 -2
- package/build/pdfmake.js +26384 -25999
- package/build/pdfmake.js.map +1 -1
- package/build/pdfmake.min.js +2 -2
- package/build/pdfmake.min.js.map +1 -1
- package/build/vfs_fonts.js +2 -1
- package/js/DocMeasure.js +9 -0
- package/js/DocumentContext.js +25 -9
- package/js/ElementWriter.js +12 -3
- package/js/LayoutBuilder.js +239 -118
- package/js/PageElementWriter.js +15 -0
- package/js/Printer.js +13 -0
- package/js/Renderer.js +22 -14
- package/js/SVGMeasure.js +2 -2
- package/js/TextInlines.js +1 -1
- package/js/URLResolver.js +3 -0
- package/js/helpers/tools.js +6 -0
- package/package.json +14 -14
- package/src/DocMeasure.js +8 -0
- package/src/DocumentContext.js +26 -12
- package/src/ElementWriter.js +11 -2
- package/src/LayoutBuilder.js +250 -119
- package/src/PageElementWriter.js +19 -0
- package/src/Printer.js +15 -0
- package/src/Renderer.js +13 -15
- package/src/SVGMeasure.js +2 -2
- package/src/TextInlines.js +1 -1
- package/src/URLResolver.js +4 -0
- package/src/helpers/tools.js +5 -0
- package/standard-fonts/Helvetica.js +0 -1
- package/.idea/workspace.xml +0 -20
- package/eslint.config.mjs +0 -52
package/src/SVGMeasure.js
CHANGED
|
@@ -7,7 +7,7 @@ import xmldoc from 'xmldoc';
|
|
|
7
7
|
* @returns {?number}
|
|
8
8
|
*/
|
|
9
9
|
const stripUnits = textVal => {
|
|
10
|
-
|
|
10
|
+
let n = parseFloat(textVal);
|
|
11
11
|
if (typeof n !== 'number' || isNaN(n)) {
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
@@ -21,7 +21,7 @@ const stripUnits = textVal => {
|
|
|
21
21
|
* @returns {object}
|
|
22
22
|
*/
|
|
23
23
|
const parseSVG = (svgString) => {
|
|
24
|
-
|
|
24
|
+
let doc;
|
|
25
25
|
|
|
26
26
|
try {
|
|
27
27
|
doc = new xmldoc.XmlDocument(svgString);
|
package/src/TextInlines.js
CHANGED
|
@@ -45,7 +45,7 @@ class TextInlines {
|
|
|
45
45
|
* Converts an array of strings (or inline-definition-objects) into a collection
|
|
46
46
|
* of inlines and calculated minWidth/maxWidth and their min/max widths
|
|
47
47
|
*
|
|
48
|
-
* @param {Array} textArray an array of inline-definition-objects (or strings)
|
|
48
|
+
* @param {Array|object} textArray an array of inline-definition-objects (or strings)
|
|
49
49
|
* @param {StyleContextStack} styleContextStack current style stack
|
|
50
50
|
* @returns {object} collection of inlines, minWidth, maxWidth
|
|
51
51
|
*/
|
package/src/URLResolver.js
CHANGED
|
@@ -11,6 +11,8 @@ const fetchUrl = (url, headers = {}) => {
|
|
|
11
11
|
|
|
12
12
|
h.get(url, options, res => {
|
|
13
13
|
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) { // redirect url
|
|
14
|
+
res.resume();
|
|
15
|
+
|
|
14
16
|
fetchUrl(res.headers.location).then(buffer => {
|
|
15
17
|
resolve(buffer);
|
|
16
18
|
}, result => {
|
|
@@ -22,6 +24,8 @@ const fetchUrl = (url, headers = {}) => {
|
|
|
22
24
|
const ok = res.statusCode >= 200 && res.statusCode < 300;
|
|
23
25
|
if (!ok) {
|
|
24
26
|
reject(new TypeError(`Failed to fetch (status code: ${res.statusCode}, url: "${url}")`));
|
|
27
|
+
res.resume();
|
|
28
|
+
return;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
const chunks = [];
|
package/src/helpers/tools.js
CHANGED
package/.idea/workspace.xml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="c4bce3c1-f7dd-40d1-aca3-b1df83792070" name="Default Changelist" comment="" />
|
|
5
|
-
<option name="SHOW_DIALOG" value="false" />
|
|
6
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
7
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
8
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
9
|
-
</component>
|
|
10
|
-
<component name="ComposerSettings">
|
|
11
|
-
<execution />
|
|
12
|
-
</component>
|
|
13
|
-
<component name="PropertiesComponent">
|
|
14
|
-
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
|
15
|
-
<property name="ts.external.directory.path" value="C:\Program Files\JetBrains\PhpStorm 2021.1.2\plugins\JavaScriptLanguage\jsLanguageServicesImpl\external" />
|
|
16
|
-
</component>
|
|
17
|
-
<component name="TaskManager">
|
|
18
|
-
<servers />
|
|
19
|
-
</component>
|
|
20
|
-
</project>
|
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
|
-
];
|