pdfmake 0.1.71 → 0.2.2
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 +20 -0
- package/README.md +4 -7
- package/build/pdfmake.js +73605 -72725
- 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.js +44 -0
- package/package.json +84 -74
- package/src/browser-extensions/pdfMake.js +10 -0
- package/src/pdfKitEngine.js +1 -1
- package/src/textTools.js +1 -1
package/build-vfs.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
const vfsBefore = "this.pdfMake = this.pdfMake || {}; this.pdfMake.vfs = ";
|
|
4
|
+
const vfsAfter = ";";
|
|
5
|
+
const sourcePath = process.argv[2];
|
|
6
|
+
const vfsFilename = process.argv[3] ? process.argv[2] : './build/vfs_fonts.js';
|
|
7
|
+
|
|
8
|
+
var vfs = {};
|
|
9
|
+
|
|
10
|
+
if (sourcePath === undefined) {
|
|
11
|
+
console.error('Usage: node build-vfs.js path [filename]');
|
|
12
|
+
console.log('');
|
|
13
|
+
console.log('Parameters:');
|
|
14
|
+
console.log(' path Source path with fonts.');
|
|
15
|
+
console.log(' filename Optional. Output vfs file. Default: ./build/vfs_fonts.js');
|
|
16
|
+
console.log('');
|
|
17
|
+
console.log('Examples:');
|
|
18
|
+
console.log(' node build-vfs.js "examples/fonts"');
|
|
19
|
+
console.log(' node build-vfs.js "examples/fonts" "./build/vfs_fonts.js"');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!fs.existsSync(sourcePath)) {
|
|
24
|
+
console.error('Source path "' + sourcePath + '" not found.');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.log('Source path:', sourcePath);
|
|
29
|
+
console.log('');
|
|
30
|
+
|
|
31
|
+
var files = fs.readdirSync(sourcePath);
|
|
32
|
+
|
|
33
|
+
files.forEach(function (file) {
|
|
34
|
+
var fileBase64 = fs.readFileSync(sourcePath + '/' + file).toString('base64');
|
|
35
|
+
console.log('FILE:', file);
|
|
36
|
+
|
|
37
|
+
vfs[file] = fileBase64;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const vfsFileContent = vfsBefore + JSON.stringify(vfs, null, 2) + vfsAfter;
|
|
41
|
+
fs.writeFileSync(vfsFilename, vfsFileContent);
|
|
42
|
+
|
|
43
|
+
console.log('');
|
|
44
|
+
console.log('Builded ' + files.length + ' files to ' + vfsFilename + '.');
|
package/package.json
CHANGED
|
@@ -1,74 +1,84 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pdfmake",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Client/server side PDF printing in pure JavaScript",
|
|
5
|
-
"main": "src/printer.js",
|
|
6
|
-
"browser": "build/pdfmake.js",
|
|
7
|
-
"directories": {
|
|
8
|
-
"test": "tests"
|
|
9
|
-
},
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"svg-to-pdfkit": "^0.1.8",
|
|
15
|
-
"xmldoc": "^1.1.2"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@babel/
|
|
19
|
-
"@babel/
|
|
20
|
-
"@babel/
|
|
21
|
-
"babel-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"webpack": "^
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "pdfmake",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "Client/server side PDF printing in pure JavaScript",
|
|
5
|
+
"main": "src/printer.js",
|
|
6
|
+
"browser": "build/pdfmake.js",
|
|
7
|
+
"directories": {
|
|
8
|
+
"test": "tests"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@foliojs-fork/linebreak": "^1.1.1",
|
|
12
|
+
"@foliojs-fork/pdfkit": "^0.12.3",
|
|
13
|
+
"iconv-lite": "^0.6.3",
|
|
14
|
+
"svg-to-pdfkit": "^0.1.8",
|
|
15
|
+
"xmldoc": "^1.1.2"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@babel/cli": "^7.14.5",
|
|
19
|
+
"@babel/core": "^7.14.6",
|
|
20
|
+
"@babel/plugin-transform-modules-commonjs": "^7.14.5",
|
|
21
|
+
"@babel/preset-env": "^7.14.7",
|
|
22
|
+
"assert": "^2.0.0",
|
|
23
|
+
"babel-loader": "^8.2.2",
|
|
24
|
+
"brfs": "^2.0.2",
|
|
25
|
+
"browserify-zlib": "^0.2.0",
|
|
26
|
+
"buffer": "^6.0.3",
|
|
27
|
+
"core-js": "^3.15.2",
|
|
28
|
+
"eslint": "^7.29.0",
|
|
29
|
+
"eslint-plugin-jsdoc": "^35.4.1",
|
|
30
|
+
"expose-loader": "^3.0.0",
|
|
31
|
+
"file-saver": "^2.0.5",
|
|
32
|
+
"mocha": "^9.0.1",
|
|
33
|
+
"npm-run-all": "^4.1.5",
|
|
34
|
+
"process": "^0.11.10",
|
|
35
|
+
"rewire": "^5.0.0",
|
|
36
|
+
"sinon": "^11.1.1",
|
|
37
|
+
"stream-browserify": "^3.0.0",
|
|
38
|
+
"string-replace-webpack-plugin": "^0.1.3",
|
|
39
|
+
"terser-webpack-plugin": "^5.1.4",
|
|
40
|
+
"transform-loader": "^0.2.4",
|
|
41
|
+
"util": "^0.12.4",
|
|
42
|
+
"webpack": "^5.42.0",
|
|
43
|
+
"webpack-cli": "^4.7.2"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=12"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"test": "run-s build mocha",
|
|
50
|
+
"build": "run-s build:browser",
|
|
51
|
+
"build:browser": "webpack",
|
|
52
|
+
"build:browser-standard-fonts": "webpack --config webpack-standardfonts.config.js",
|
|
53
|
+
"build:vfs": "node build-vfs.js \"./examples/fonts\"",
|
|
54
|
+
"build:examples": "node build-examples.js",
|
|
55
|
+
"lint": "eslint \"./src/**/*.js\" \"./tests/**/*.js\" \"./examples/**/*.js\"",
|
|
56
|
+
"mocha": "mocha --reporter spec \"./tests/**/*.js\"",
|
|
57
|
+
"playground": "node dev-playground/server.js"
|
|
58
|
+
},
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "git://github.com/bpampuch/pdfmake.git"
|
|
62
|
+
},
|
|
63
|
+
"keywords": [
|
|
64
|
+
"pdf",
|
|
65
|
+
"javascript",
|
|
66
|
+
"printing",
|
|
67
|
+
"layout"
|
|
68
|
+
],
|
|
69
|
+
"author": "Bartek Pampuch <bartosz.pampuch@gmail.com>",
|
|
70
|
+
"license": "MIT",
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/bpampuch/pdfmake/issues"
|
|
73
|
+
},
|
|
74
|
+
"homepage": "http://pdfmake.org",
|
|
75
|
+
"config": {
|
|
76
|
+
"blanket": {
|
|
77
|
+
"pattern": "src",
|
|
78
|
+
"data-cover-never": [
|
|
79
|
+
"node_modules",
|
|
80
|
+
"tests"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -24,6 +24,16 @@ function Document(docDefinition, tableLayouts, fonts, vfs) {
|
|
|
24
24
|
|
|
25
25
|
function canCreatePdf() {
|
|
26
26
|
// Ensure the browser provides the level of support needed
|
|
27
|
+
try {
|
|
28
|
+
var arr = new Uint8Array(1)
|
|
29
|
+
var proto = { foo: function () { return 42 } }
|
|
30
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype)
|
|
31
|
+
Object.setPrototypeOf(arr, proto)
|
|
32
|
+
return arr.foo() === 42
|
|
33
|
+
} catch (e) {
|
|
34
|
+
return false
|
|
35
|
+
}
|
|
36
|
+
|
|
27
37
|
if (!Object.keys || typeof Uint16Array === 'undefined') {
|
|
28
38
|
return false;
|
|
29
39
|
}
|
package/src/pdfKitEngine.js
CHANGED
|
@@ -4,7 +4,7 @@ function _interopDefault(ex) {
|
|
|
4
4
|
return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
var PdfKit = _interopDefault(require('pdfkit'));
|
|
7
|
+
var PdfKit = _interopDefault(require('@foliojs-fork/pdfkit'));
|
|
8
8
|
|
|
9
9
|
function getEngineInstance() {
|
|
10
10
|
return PdfKit;
|
package/src/textTools.js
CHANGED
|
@@ -5,7 +5,7 @@ var isNumber = require('./helpers').isNumber;
|
|
|
5
5
|
var isObject = require('./helpers').isObject;
|
|
6
6
|
var isArray = require('./helpers').isArray;
|
|
7
7
|
var isUndefined = require('./helpers').isUndefined;
|
|
8
|
-
var LineBreaker = require('linebreak');
|
|
8
|
+
var LineBreaker = require('@foliojs-fork/linebreak');
|
|
9
9
|
|
|
10
10
|
var LEADING = /^(\s)+/g;
|
|
11
11
|
var TRAILING = /(\s)+$/g;
|