pdfmake 0.3.0-beta.6 → 0.3.0-beta.8

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +1 -1
  3. package/build/pdfmake.js +36523 -36424
  4. package/build/pdfmake.js.map +1 -1
  5. package/build/pdfmake.min.js +2 -2
  6. package/build/pdfmake.min.js.map +1 -1
  7. package/package.json +21 -20
  8. package/src/DocMeasure.js +3 -0
  9. package/src/Printer.js +1 -0
  10. package/src/TableProcessor.js +4 -0
  11. package/src/TextDecorator.js +1 -1
  12. package/src/qrEnc.js +5 -3
  13. package/js/3rd-party/svg-to-pdfkit/source.js +0 -3628
  14. package/js/3rd-party/svg-to-pdfkit.js +0 -7
  15. package/js/DocMeasure.js +0 -624
  16. package/js/DocPreprocessor.js +0 -238
  17. package/js/DocumentContext.js +0 -265
  18. package/js/ElementWriter.js +0 -331
  19. package/js/LayoutBuilder.js +0 -694
  20. package/js/Line.js +0 -105
  21. package/js/OutputDocument.js +0 -76
  22. package/js/OutputDocumentServer.js +0 -27
  23. package/js/PDFDocument.js +0 -144
  24. package/js/PageElementWriter.js +0 -140
  25. package/js/PageSize.js +0 -74
  26. package/js/Printer.js +0 -290
  27. package/js/Renderer.js +0 -375
  28. package/js/SVGMeasure.js +0 -69
  29. package/js/StyleContextStack.js +0 -181
  30. package/js/TableProcessor.js +0 -508
  31. package/js/TextBreaker.js +0 -139
  32. package/js/TextDecorator.js +0 -143
  33. package/js/TextInlines.js +0 -206
  34. package/js/URLResolver.js +0 -73
  35. package/js/base.js +0 -52
  36. package/js/browser-extensions/OutputDocumentBrowser.js +0 -118
  37. package/js/browser-extensions/URLBrowserResolver.js +0 -76
  38. package/js/browser-extensions/fonts/Roboto.js +0 -38
  39. package/js/browser-extensions/index.js +0 -53
  40. package/js/browser-extensions/pdfMake.js +0 -15
  41. package/js/browser-extensions/standard-fonts/Courier.js +0 -38
  42. package/js/browser-extensions/standard-fonts/Helvetica.js +0 -38
  43. package/js/browser-extensions/standard-fonts/Symbol.js +0 -23
  44. package/js/browser-extensions/standard-fonts/Times.js +0 -38
  45. package/js/browser-extensions/standard-fonts/ZapfDingbats.js +0 -23
  46. package/js/browser-extensions/virtual-fs-cjs.js +0 -3
  47. package/js/columnCalculator.js +0 -129
  48. package/js/helpers/node.js +0 -98
  49. package/js/helpers/tools.js +0 -40
  50. package/js/helpers/variableType.js +0 -47
  51. package/js/index.js +0 -15
  52. package/js/qrEnc.js +0 -720
  53. package/js/standardPageSizes.js +0 -56
  54. package/js/tableLayouts.js +0 -98
  55. package/js/virtual-fs.js +0 -60
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdfmake",
3
- "version": "0.3.0-beta.6",
3
+ "version": "0.3.0-beta.8",
4
4
  "description": "Client/server side PDF printing in pure JavaScript",
5
5
  "main": "js/index.js",
6
6
  "esnext": "src/index.js",
@@ -12,40 +12,41 @@
12
12
  "@foliojs-fork/linebreak": "^1.1.1",
13
13
  "@foliojs-fork/pdfkit": "^0.14.0",
14
14
  "iconv-lite": "^0.6.3",
15
- "xmldoc": "^1.1.2"
15
+ "xmldoc": "^1.3.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@babel/cli": "^7.16.7",
19
- "@babel/core": "^7.16.7",
20
- "@babel/plugin-transform-modules-commonjs": "^7.16.7",
21
- "@babel/preset-env": "^7.16.7",
22
- "assert": "^2.0.0",
23
- "babel-loader": "^8.2.3",
18
+ "@babel/cli": "^7.23.4",
19
+ "@babel/core": "^7.23.6",
20
+ "@babel/plugin-transform-modules-commonjs": "^7.23.3",
21
+ "@babel/preset-env": "^7.23.6",
22
+ "assert": "^2.1.0",
23
+ "babel-loader": "^9.1.3",
24
24
  "brfs": "^2.0.2",
25
25
  "browserify-zlib": "^0.2.0",
26
26
  "buffer": "6.0.3",
27
27
  "core-js": "3.19.0",
28
- "eslint": "^8.5.0",
29
- "eslint-plugin-jsdoc": "^37.4.2",
30
- "expose-loader": "^3.1.0",
28
+ "eslint": "^8.55.0",
29
+ "eslint-plugin-jsdoc": "^46.9.1",
30
+ "expose-loader": "^4.1.0",
31
31
  "file-saver": "^2.0.5",
32
- "mocha": "^9.1.3",
32
+ "mocha": "^10.2.0",
33
33
  "npm-run-all": "^4.1.5",
34
34
  "process": "^0.11.10",
35
- "rewire": "^6.0.0",
36
- "shx": "^0.3.3",
37
- "sinon": "^12.0.1",
35
+ "rewire": "^7.0.0",
36
+ "shx": "^0.3.4",
37
+ "sinon": "^17.0.1",
38
+ "source-map-loader": "^4.0.1",
38
39
  "stream-browserify": "^3.0.0",
39
40
  "string-replace-webpack-plugin": "^0.1.3",
40
41
  "svg-to-pdfkit": "^0.1.8",
41
- "terser-webpack-plugin": "^5.3.0",
42
+ "terser-webpack-plugin": "^5.3.9",
42
43
  "transform-loader": "^0.2.4",
43
- "util": "^0.12.4",
44
- "webpack": "^5.65.0",
45
- "webpack-cli": "^4.9.1"
44
+ "util": "^0.12.5",
45
+ "webpack": "^5.89.0",
46
+ "webpack-cli": "^5.1.4"
46
47
  },
47
48
  "engines": {
48
- "node": ">=14"
49
+ "node": ">=16"
49
50
  },
50
51
  "scripts": {
51
52
  "test": "run-s build mocha lint",
package/src/DocMeasure.js CHANGED
@@ -85,6 +85,9 @@ class DocMeasure {
85
85
  let factor = (dimensions.width / dimensions.height > node.fit[0] / node.fit[1]) ? node.fit[0] / dimensions.width : node.fit[1] / dimensions.height;
86
86
  node._width = node._minWidth = node._maxWidth = dimensions.width * factor;
87
87
  node._height = dimensions.height * factor;
88
+ } else if (node.cover) {
89
+ node._width = node._minWidth = node._maxWidth = node.cover.width;
90
+ node._height = node._minHeight = node._maxHeight = node.cover.height;
88
91
  } else {
89
92
  node._width = node._minWidth = node._maxWidth = node.width || dimensions.width;
90
93
  node._height = node.height || (dimensions.height * node._width / dimensions.width);
package/src/Printer.js CHANGED
@@ -62,6 +62,7 @@ class PdfPrinter {
62
62
  userPassword: docDefinition.userPassword,
63
63
  ownerPassword: docDefinition.ownerPassword,
64
64
  permissions: docDefinition.permissions,
65
+ lang: docDefinition.language,
65
66
  fontLayoutCache: typeof options.fontLayoutCache === 'boolean' ? options.fontLayoutCache : true,
66
67
  bufferPages: options.bufferPages || false,
67
68
  autoFirstPage: false,
@@ -102,6 +102,10 @@ class TableProcessor {
102
102
  this.cleanUpRepeatables = false;
103
103
 
104
104
  this.headerRows = tableNode.table.headerRows || 0;
105
+ if (this.headerRows > tableNode.table.body.length) {
106
+ throw new Error(`Too few rows in the table. Property headerRows requires at least ${this.headerRows}, contains only ${tableNode.table.body.length}`);
107
+ }
108
+
105
109
  this.rowsWithoutPageBreak = this.headerRows + (tableNode.table.keepWithHeaderRows || 0);
106
110
  this.dontBreakRows = tableNode.table.dontBreakRows || false;
107
111
 
@@ -109,7 +109,7 @@ class TextDecorator {
109
109
  y += lineAscent - (ascent * 0.25);
110
110
  break;
111
111
  default:
112
- throw new Error(`Unkown decoration : ${group.decoration}`);
112
+ throw new Error(`Unknown decoration : ${group.decoration}`);
113
113
  }
114
114
  this.pdfDocument.save();
115
115
 
package/src/qrEnc.js CHANGED
@@ -748,11 +748,13 @@ function buildCanvas(data, options) {
748
748
  var canvas = [];
749
749
  var background = options.background || '#fff';
750
750
  var foreground = options.foreground || '#000';
751
+ var padding = options.padding || 0;
751
752
  //var margin = options.margin || 4;
752
753
  var matrix = generateFrame(data, options);
753
754
  var n = matrix.length;
754
755
  var modSize = Math.floor(options.fit ? options.fit / n : 5);
755
- var size = n * modSize;
756
+ var size = (n * modSize) + (modSize * padding * 2);
757
+ var paddingXY = modSize * padding;
756
758
 
757
759
  canvas.push({
758
760
  type: 'rect',
@@ -764,8 +766,8 @@ function buildCanvas(data, options) {
764
766
  if (matrix[i][j]) {
765
767
  canvas.push({
766
768
  type: 'rect',
767
- x: modSize * j,
768
- y: modSize * i,
769
+ x: modSize * j + paddingXY,
770
+ y: modSize * i + paddingXY,
769
771
  w: modSize,
770
772
  h: modSize,
771
773
  lineWidth: 0,