pdfmake 0.3.0-beta.15 → 0.3.0-beta.16
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 +8 -1
- package/README.md +2 -2
- package/build/pdfmake.js +63338 -62894
- 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 +4 -5
- package/fonts/Roboto/Roboto-Italic.ttf +0 -0
- package/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
- package/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/js/base.js +1 -1
- package/js/browser-extensions/URLBrowserResolver.js +10 -5
- package/js/browser-extensions/index.js +1 -1
- package/js/index.js +1 -1
- package/package.json +19 -19
- package/src/base.js +1 -1
- package/src/browser-extensions/URLBrowserResolver.js +10 -5
- package/src/browser-extensions/index.js +1 -1
- package/src/index.js +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/js/base.js
CHANGED
|
@@ -20,7 +20,7 @@ class pdfmake {
|
|
|
20
20
|
createPdf(docDefinition, options = {}) {
|
|
21
21
|
options.progressCallback = this.progressCallback;
|
|
22
22
|
options.tableLayouts = this.tableLayouts;
|
|
23
|
-
let printer = new _Printer.default(this.fonts, this.virtualfs, this.urlResolver);
|
|
23
|
+
let printer = new _Printer.default(this.fonts, this.virtualfs, this.urlResolver());
|
|
24
24
|
const pdfDocumentPromise = printer.createPdfKitDocument(docDefinition, options);
|
|
25
25
|
return this._transformToDocument(pdfDocumentPromise);
|
|
26
26
|
}
|
|
@@ -49,12 +49,17 @@ class URLBrowserResolver {
|
|
|
49
49
|
if (!this.resolving[url]) {
|
|
50
50
|
this.resolving[url] = new Promise((resolve, reject) => {
|
|
51
51
|
if (url.toLowerCase().indexOf('https://') === 0 || url.toLowerCase().indexOf('http://') === 0) {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if (this.fs.existsSync(url)) {
|
|
53
|
+
// url was downloaded earlier
|
|
54
54
|
resolve();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
} else {
|
|
56
|
+
fetchUrl(url, headers).then(buffer => {
|
|
57
|
+
this.fs.writeFileSync(url, buffer);
|
|
58
|
+
resolve();
|
|
59
|
+
}, result => {
|
|
60
|
+
reject(result);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
58
63
|
} else {
|
|
59
64
|
// cannot be resolved
|
|
60
65
|
resolve();
|
|
@@ -23,7 +23,7 @@ let defaultClientFonts = {
|
|
|
23
23
|
class pdfmake extends _base.default {
|
|
24
24
|
constructor() {
|
|
25
25
|
super();
|
|
26
|
-
this.urlResolver = new _URLBrowserResolver.default(this.virtualfs);
|
|
26
|
+
this.urlResolver = () => new _URLBrowserResolver.default(this.virtualfs);
|
|
27
27
|
this.fonts = defaultClientFonts;
|
|
28
28
|
}
|
|
29
29
|
addFontContainer(fontContainer) {
|
package/js/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const URLResolver = require('./URLResolver').default;
|
|
|
6
6
|
class pdfmake extends pdfmakeBase {
|
|
7
7
|
constructor() {
|
|
8
8
|
super();
|
|
9
|
-
this.urlResolver = new URLResolver(this.virtualfs);
|
|
9
|
+
this.urlResolver = () => new URLResolver(this.virtualfs);
|
|
10
10
|
}
|
|
11
11
|
_transformToDocument(doc) {
|
|
12
12
|
return new OutputDocumentServer(doc);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfmake",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.16",
|
|
4
4
|
"description": "Client/server side PDF printing in pure JavaScript",
|
|
5
5
|
"main": "js/index.js",
|
|
6
6
|
"esnext": "src/index.js",
|
|
@@ -10,40 +10,40 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"linebreak": "^1.1.0",
|
|
13
|
-
"pdfkit": "^0.
|
|
14
|
-
"xmldoc": "^
|
|
13
|
+
"pdfkit": "^0.17.0",
|
|
14
|
+
"xmldoc": "^2.0.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@babel/cli": "^7.
|
|
18
|
-
"@babel/core": "^7.26.
|
|
17
|
+
"@babel/cli": "^7.27.0",
|
|
18
|
+
"@babel/core": "^7.26.10",
|
|
19
19
|
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
|
|
20
|
-
"@babel/preset-env": "^7.26.
|
|
21
|
-
"@eslint/js": "^9.
|
|
20
|
+
"@babel/preset-env": "^7.26.9",
|
|
21
|
+
"@eslint/js": "^9.25.1",
|
|
22
22
|
"assert": "^2.1.0",
|
|
23
|
-
"babel-loader": "^
|
|
23
|
+
"babel-loader": "^10.0.0",
|
|
24
24
|
"brfs": "^2.0.2",
|
|
25
25
|
"browserify-zlib": "^0.2.0",
|
|
26
|
-
"buffer": "6.0.3",
|
|
27
|
-
"core-js": "3.
|
|
28
|
-
"eslint": "^9.
|
|
29
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
30
|
-
"expose-loader": "^5.0.
|
|
26
|
+
"buffer": "^6.0.3",
|
|
27
|
+
"core-js": "^3.41.0",
|
|
28
|
+
"eslint": "^9.25.1",
|
|
29
|
+
"eslint-plugin-jsdoc": "^50.6.11",
|
|
30
|
+
"expose-loader": "^5.0.1",
|
|
31
31
|
"file-saver": "^2.0.5",
|
|
32
|
-
"globals": "^
|
|
33
|
-
"mocha": "^11.0
|
|
32
|
+
"globals": "^16.0.0",
|
|
33
|
+
"mocha": "^11.1.0",
|
|
34
34
|
"npm-run-all": "^4.1.5",
|
|
35
35
|
"process": "^0.11.10",
|
|
36
36
|
"rewire": "^7.0.0",
|
|
37
|
-
"shx": "^0.
|
|
38
|
-
"sinon": "^
|
|
37
|
+
"shx": "^0.4.0",
|
|
38
|
+
"sinon": "^20.0.0",
|
|
39
39
|
"source-map-loader": "^5.0.0",
|
|
40
40
|
"stream-browserify": "^3.0.0",
|
|
41
41
|
"string-replace-webpack-plugin": "^0.1.3",
|
|
42
42
|
"svg-to-pdfkit": "^0.1.8",
|
|
43
|
-
"terser-webpack-plugin": "^5.3.
|
|
43
|
+
"terser-webpack-plugin": "^5.3.14",
|
|
44
44
|
"transform-loader": "^0.2.4",
|
|
45
45
|
"util": "^0.12.5",
|
|
46
|
-
"webpack": "^5.
|
|
46
|
+
"webpack": "^5.99.7",
|
|
47
47
|
"webpack-cli": "^6.0.1"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
package/src/base.js
CHANGED
|
@@ -18,7 +18,7 @@ class pdfmake {
|
|
|
18
18
|
options.progressCallback = this.progressCallback;
|
|
19
19
|
options.tableLayouts = this.tableLayouts;
|
|
20
20
|
|
|
21
|
-
let printer = new Printer(this.fonts, this.virtualfs, this.urlResolver);
|
|
21
|
+
let printer = new Printer(this.fonts, this.virtualfs, this.urlResolver());
|
|
22
22
|
const pdfDocumentPromise = printer.createPdfKitDocument(docDefinition, options);
|
|
23
23
|
|
|
24
24
|
return this._transformToDocument(pdfDocumentPromise);
|
|
@@ -53,12 +53,17 @@ class URLBrowserResolver {
|
|
|
53
53
|
if (!this.resolving[url]) {
|
|
54
54
|
this.resolving[url] = new Promise((resolve, reject) => {
|
|
55
55
|
if (url.toLowerCase().indexOf('https://') === 0 || url.toLowerCase().indexOf('http://') === 0) {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
if (this.fs.existsSync(url)) {
|
|
57
|
+
// url was downloaded earlier
|
|
58
58
|
resolve();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
} else {
|
|
60
|
+
fetchUrl(url, headers).then(buffer => {
|
|
61
|
+
this.fs.writeFileSync(url, buffer);
|
|
62
|
+
resolve();
|
|
63
|
+
}, result => {
|
|
64
|
+
reject(result);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
62
67
|
} else {
|
|
63
68
|
// cannot be resolved
|
|
64
69
|
resolve();
|
|
@@ -21,7 +21,7 @@ let defaultClientFonts = {
|
|
|
21
21
|
class pdfmake extends pdfmakeBase {
|
|
22
22
|
constructor() {
|
|
23
23
|
super();
|
|
24
|
-
this.urlResolver = new URLBrowserResolver(this.virtualfs);
|
|
24
|
+
this.urlResolver = () => new URLBrowserResolver(this.virtualfs);
|
|
25
25
|
this.fonts = defaultClientFonts;
|
|
26
26
|
}
|
|
27
27
|
|
package/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const URLResolver = require('./URLResolver').default;
|
|
|
5
5
|
class pdfmake extends pdfmakeBase {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
|
-
this.urlResolver = new URLResolver(this.virtualfs);
|
|
8
|
+
this.urlResolver = () => new URLResolver(this.virtualfs);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
_transformToDocument(doc) {
|