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/src/SVGMeasure.js CHANGED
@@ -7,7 +7,7 @@ import xmldoc from 'xmldoc';
7
7
  * @returns {?number}
8
8
  */
9
9
  const stripUnits = textVal => {
10
- var n = parseFloat(textVal);
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
- var doc;
24
+ let doc;
25
25
 
26
26
  try {
27
27
  doc = new xmldoc.XmlDocument(svgString);
@@ -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
  */
@@ -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 = [];
@@ -37,3 +37,8 @@ export function offsetVector(vector, x, y) {
37
37
  break;
38
38
  }
39
39
  }
40
+
41
+ export function convertToDynamicContent(staticContent) {
42
+ return () => // copy to new object
43
+ JSON.parse(JSON.stringify(staticContent));
44
+ }
@@ -6,4 +6,3 @@ module.exports = {
6
6
  bolditalics: 'Helvetica-BoldOblique'
7
7
  }
8
8
  };
9
-
@@ -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
- ];