pdfmake 0.3.2 → 0.3.4

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 (94) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +21 -21
  3. package/README.md +75 -78
  4. package/build/fonts/Roboto/Roboto-Italic.ttf +0 -0
  5. package/build/fonts/Roboto/Roboto-Medium.ttf +0 -0
  6. package/build/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  7. package/build/fonts/Roboto/Roboto-Regular.ttf +0 -0
  8. package/build/fonts/Roboto.js +27 -0
  9. package/build/pdfmake.js +64813 -64584
  10. package/build/pdfmake.js.map +1 -1
  11. package/build/pdfmake.min.js +2 -2
  12. package/build/pdfmake.min.js.map +1 -1
  13. package/build/standard-fonts/Courier.js +27 -27
  14. package/build/standard-fonts/Helvetica.js +27 -27
  15. package/build/standard-fonts/Symbol.js +21 -21
  16. package/build/standard-fonts/Times.js +27 -27
  17. package/build/standard-fonts/ZapfDingbats.js +21 -21
  18. package/build/vfs_fonts.js +5 -5
  19. package/build-vfs.js +44 -44
  20. package/fonts/Roboto.js +8 -8
  21. package/js/3rd-party/svg-to-pdfkit/source.js +1 -1
  22. package/js/DocMeasure.js +11 -6
  23. package/js/DocumentContext.js +8 -3
  24. package/js/ElementWriter.js +42 -16
  25. package/js/LayoutBuilder.js +144 -78
  26. package/js/Line.js +16 -16
  27. package/js/OutputDocument.js +10 -10
  28. package/js/OutputDocumentServer.js +3 -3
  29. package/js/PDFDocument.js +3 -3
  30. package/js/PageElementWriter.js +15 -9
  31. package/js/Printer.js +28 -28
  32. package/js/Renderer.js +40 -8
  33. package/js/SVGMeasure.js +10 -10
  34. package/js/StyleContextStack.js +74 -51
  35. package/js/TableProcessor.js +14 -0
  36. package/js/TextBreaker.js +17 -17
  37. package/js/TextDecorator.js +12 -3
  38. package/js/TextInlines.js +34 -33
  39. package/js/base.js +4 -4
  40. package/js/browser-extensions/OutputDocumentBrowser.js +24 -24
  41. package/js/columnCalculator.js +2 -2
  42. package/js/helpers/node.js +47 -23
  43. package/js/helpers/variableType.js +18 -18
  44. package/js/qrEnc.js +38 -38
  45. package/js/virtual-fs.js +11 -11
  46. package/package.json +12 -12
  47. package/src/3rd-party/svg-to-pdfkit/LICENSE +9 -9
  48. package/src/3rd-party/svg-to-pdfkit/source.js +2745 -2745
  49. package/src/3rd-party/svg-to-pdfkit.js +3 -3
  50. package/src/DocMeasure.js +745 -738
  51. package/src/DocPreprocessor.js +283 -283
  52. package/src/DocumentContext.js +345 -338
  53. package/src/ElementWriter.js +441 -417
  54. package/src/LayoutBuilder.js +1336 -1258
  55. package/src/Line.js +114 -114
  56. package/src/OutputDocument.js +64 -64
  57. package/src/OutputDocumentServer.js +32 -32
  58. package/src/PDFDocument.js +174 -174
  59. package/src/PageElementWriter.js +187 -179
  60. package/src/PageSize.js +53 -53
  61. package/src/Printer.js +306 -306
  62. package/src/Renderer.js +445 -409
  63. package/src/SVGMeasure.js +109 -109
  64. package/src/StyleContextStack.js +208 -179
  65. package/src/TableProcessor.js +620 -602
  66. package/src/TextBreaker.js +168 -168
  67. package/src/TextDecorator.js +175 -161
  68. package/src/TextInlines.js +224 -223
  69. package/src/URLResolver.js +43 -43
  70. package/src/base.js +70 -70
  71. package/src/browser-extensions/OutputDocumentBrowser.js +80 -80
  72. package/src/browser-extensions/fonts/Roboto.js +27 -27
  73. package/src/browser-extensions/index.js +55 -55
  74. package/src/browser-extensions/pdfMake.js +1 -1
  75. package/src/browser-extensions/standard-fonts/Courier.js +27 -27
  76. package/src/browser-extensions/standard-fonts/Helvetica.js +27 -27
  77. package/src/browser-extensions/standard-fonts/Symbol.js +21 -21
  78. package/src/browser-extensions/standard-fonts/Times.js +27 -27
  79. package/src/browser-extensions/standard-fonts/ZapfDingbats.js +21 -21
  80. package/src/browser-extensions/virtual-fs-cjs.js +1 -1
  81. package/src/columnCalculator.js +154 -154
  82. package/src/helpers/node.js +134 -110
  83. package/src/helpers/tools.js +44 -44
  84. package/src/helpers/variableType.js +50 -50
  85. package/src/index.js +16 -16
  86. package/src/qrEnc.js +796 -796
  87. package/src/standardPageSizes.js +52 -52
  88. package/src/tableLayouts.js +100 -100
  89. package/src/virtual-fs.js +66 -66
  90. package/standard-fonts/Courier.js +8 -8
  91. package/standard-fonts/Helvetica.js +8 -8
  92. package/standard-fonts/Symbol.js +5 -5
  93. package/standard-fonts/Times.js +8 -8
  94. package/standard-fonts/ZapfDingbats.js +5 -5
@@ -1,44 +1,44 @@
1
- export function pack(...args) {
2
- let result = {};
3
-
4
- for (let i = 0, l = args.length; i < l; i++) {
5
- let obj = args[i];
6
-
7
- if (obj) {
8
- for (let key in obj) {
9
- if (obj.hasOwnProperty(key)) {
10
- result[key] = obj[key];
11
- }
12
- }
13
- }
14
- }
15
-
16
- return result;
17
- }
18
-
19
- export function offsetVector(vector, x, y) {
20
- switch (vector.type) {
21
- case 'ellipse':
22
- case 'rect':
23
- vector.x += x;
24
- vector.y += y;
25
- break;
26
- case 'line':
27
- vector.x1 += x;
28
- vector.x2 += x;
29
- vector.y1 += y;
30
- vector.y2 += y;
31
- break;
32
- case 'polyline':
33
- for (let i = 0, l = vector.points.length; i < l; i++) {
34
- vector.points[i].x += x;
35
- vector.points[i].y += y;
36
- }
37
- break;
38
- }
39
- }
40
-
41
- export function convertToDynamicContent(staticContent) {
42
- return () => // copy to new object
43
- JSON.parse(JSON.stringify(staticContent));
44
- }
1
+ export function pack(...args) {
2
+ let result = {};
3
+
4
+ for (let i = 0, l = args.length; i < l; i++) {
5
+ let obj = args[i];
6
+
7
+ if (obj) {
8
+ for (let key in obj) {
9
+ if (obj.hasOwnProperty(key)) {
10
+ result[key] = obj[key];
11
+ }
12
+ }
13
+ }
14
+ }
15
+
16
+ return result;
17
+ }
18
+
19
+ export function offsetVector(vector, x, y) {
20
+ switch (vector.type) {
21
+ case 'ellipse':
22
+ case 'rect':
23
+ vector.x += x;
24
+ vector.y += y;
25
+ break;
26
+ case 'line':
27
+ vector.x1 += x;
28
+ vector.x2 += x;
29
+ vector.y1 += y;
30
+ vector.y2 += y;
31
+ break;
32
+ case 'polyline':
33
+ for (let i = 0, l = vector.points.length; i < l; i++) {
34
+ vector.points[i].x += x;
35
+ vector.points[i].y += y;
36
+ }
37
+ break;
38
+ }
39
+ }
40
+
41
+ export function convertToDynamicContent(staticContent) {
42
+ return () => // copy to new object
43
+ JSON.parse(JSON.stringify(staticContent));
44
+ }
@@ -1,50 +1,50 @@
1
- /**
2
- * @param {any} variable
3
- * @returns {boolean}
4
- */
5
- export function isString(variable) {
6
- return (typeof variable === 'string') || (variable instanceof String);
7
- }
8
-
9
- /**
10
- * @param {any} variable
11
- * @returns {boolean}
12
- */
13
- export function isNumber(variable) {
14
- return ((typeof variable === 'number') || (variable instanceof Number)) && !Number.isNaN(variable);
15
- }
16
-
17
- /**
18
- * @param {any} variable
19
- * @returns {boolean}
20
- */
21
- export function isPositiveInteger(variable) {
22
- if (!isNumber(variable) || !Number.isInteger(variable) || variable <= 0) {
23
- return false;
24
- }
25
- return true;
26
- }
27
-
28
- /**
29
- * @param {any} variable
30
- * @returns {boolean}
31
- */
32
- export function isObject(variable) {
33
- return (variable !== null) && !Array.isArray(variable) && !isString(variable) && !isNumber(variable) && (typeof variable === 'object');
34
- }
35
-
36
- /**
37
- * @param {any} variable
38
- * @returns {boolean}
39
- */
40
- export function isEmptyObject(variable) {
41
- return isObject(variable) && (Object.keys(variable).length === 0);
42
- }
43
-
44
- /**
45
- * @param {any} variable
46
- * @returns {boolean}
47
- */
48
- export function isValue(variable) {
49
- return (variable !== undefined) && (variable !== null);
50
- }
1
+ /**
2
+ * @param {any} variable
3
+ * @returns {boolean}
4
+ */
5
+ export function isString(variable) {
6
+ return (typeof variable === 'string') || (variable instanceof String);
7
+ }
8
+
9
+ /**
10
+ * @param {any} variable
11
+ * @returns {boolean}
12
+ */
13
+ export function isNumber(variable) {
14
+ return ((typeof variable === 'number') || (variable instanceof Number)) && !Number.isNaN(variable);
15
+ }
16
+
17
+ /**
18
+ * @param {any} variable
19
+ * @returns {boolean}
20
+ */
21
+ export function isPositiveInteger(variable) {
22
+ if (!isNumber(variable) || !Number.isInteger(variable) || variable <= 0) {
23
+ return false;
24
+ }
25
+ return true;
26
+ }
27
+
28
+ /**
29
+ * @param {any} variable
30
+ * @returns {boolean}
31
+ */
32
+ export function isObject(variable) {
33
+ return (variable !== null) && !Array.isArray(variable) && !isString(variable) && !isNumber(variable) && (typeof variable === 'object');
34
+ }
35
+
36
+ /**
37
+ * @param {any} variable
38
+ * @returns {boolean}
39
+ */
40
+ export function isEmptyObject(variable) {
41
+ return isObject(variable) && (Object.keys(variable).length === 0);
42
+ }
43
+
44
+ /**
45
+ * @param {any} variable
46
+ * @returns {boolean}
47
+ */
48
+ export function isValue(variable) {
49
+ return (variable !== undefined) && (variable !== null);
50
+ }
package/src/index.js CHANGED
@@ -1,16 +1,16 @@
1
- const pdfmakeBase = require('./base').default;
2
- const OutputDocumentServer = require('./OutputDocumentServer').default;
3
- const URLResolver = require('./URLResolver').default;
4
-
5
- class pdfmake extends pdfmakeBase {
6
- constructor() {
7
- super();
8
- this.urlResolver = () => new URLResolver(this.virtualfs);
9
- }
10
-
11
- _transformToDocument(doc) {
12
- return new OutputDocumentServer(doc);
13
- }
14
- }
15
-
16
- module.exports = new pdfmake();
1
+ const pdfmakeBase = require('./base').default;
2
+ const OutputDocumentServer = require('./OutputDocumentServer').default;
3
+ const URLResolver = require('./URLResolver').default;
4
+
5
+ class pdfmake extends pdfmakeBase {
6
+ constructor() {
7
+ super();
8
+ this.urlResolver = () => new URLResolver(this.virtualfs);
9
+ }
10
+
11
+ _transformToDocument(doc) {
12
+ return new OutputDocumentServer(doc);
13
+ }
14
+ }
15
+
16
+ module.exports = new pdfmake();