pdfmake 0.2.13 → 0.3.0-beta.10

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 (136) hide show
  1. package/CHANGELOG.md +23 -41
  2. package/README.md +11 -7
  3. package/build/pdfmake.js +22291 -23202
  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/build/standard-fonts/Courier.js +27 -0
  8. package/build/standard-fonts/Helvetica.js +27 -0
  9. package/build/standard-fonts/Symbol.js +21 -0
  10. package/build/standard-fonts/Times.js +27 -0
  11. package/build/standard-fonts/ZapfDingbats.js +21 -0
  12. package/build/vfs_fonts.js +2 -2
  13. package/build-vfs.js +2 -2
  14. package/eslint.config.mjs +52 -0
  15. package/fonts/Roboto/Roboto-Italic.ttf +0 -0
  16. package/fonts/Roboto/Roboto-Medium.ttf +0 -0
  17. package/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  18. package/fonts/Roboto/Roboto-Regular.ttf +0 -0
  19. package/fonts/Roboto.js +8 -0
  20. package/js/3rd-party/svg-to-pdfkit/source.js +3626 -0
  21. package/js/3rd-party/svg-to-pdfkit.js +7 -0
  22. package/js/DocMeasure.js +626 -0
  23. package/js/DocPreprocessor.js +238 -0
  24. package/js/DocumentContext.js +288 -0
  25. package/js/ElementWriter.js +342 -0
  26. package/js/LayoutBuilder.js +881 -0
  27. package/js/Line.js +105 -0
  28. package/js/OutputDocument.js +76 -0
  29. package/js/OutputDocumentServer.js +27 -0
  30. package/js/PDFDocument.js +144 -0
  31. package/js/PageElementWriter.js +140 -0
  32. package/js/PageSize.js +74 -0
  33. package/js/Printer.js +291 -0
  34. package/js/Renderer.js +375 -0
  35. package/js/SVGMeasure.js +69 -0
  36. package/js/StyleContextStack.js +164 -0
  37. package/js/TableProcessor.js +524 -0
  38. package/js/TextBreaker.js +139 -0
  39. package/js/TextDecorator.js +143 -0
  40. package/js/TextInlines.js +206 -0
  41. package/js/URLResolver.js +73 -0
  42. package/js/base.js +52 -0
  43. package/js/browser-extensions/OutputDocumentBrowser.js +118 -0
  44. package/js/browser-extensions/URLBrowserResolver.js +76 -0
  45. package/js/browser-extensions/fonts/Roboto.js +38 -0
  46. package/js/browser-extensions/index.js +53 -0
  47. package/js/browser-extensions/pdfMake.js +3 -0
  48. package/js/browser-extensions/standard-fonts/Courier.js +38 -0
  49. package/js/browser-extensions/standard-fonts/Helvetica.js +38 -0
  50. package/js/browser-extensions/standard-fonts/Symbol.js +23 -0
  51. package/js/browser-extensions/standard-fonts/Times.js +38 -0
  52. package/js/browser-extensions/standard-fonts/ZapfDingbats.js +23 -0
  53. package/js/browser-extensions/virtual-fs-cjs.js +3 -0
  54. package/js/columnCalculator.js +148 -0
  55. package/js/helpers/node.js +98 -0
  56. package/js/helpers/tools.js +40 -0
  57. package/js/helpers/variableType.js +59 -0
  58. package/js/index.js +15 -0
  59. package/js/qrEnc.js +721 -0
  60. package/js/standardPageSizes.js +56 -0
  61. package/js/tableLayouts.js +98 -0
  62. package/js/virtual-fs.js +60 -0
  63. package/package.json +34 -28
  64. package/src/3rd-party/svg-to-pdfkit.js +2 -2
  65. package/src/DocMeasure.js +707 -0
  66. package/src/DocPreprocessor.js +264 -0
  67. package/src/DocumentContext.js +324 -0
  68. package/src/ElementWriter.js +405 -0
  69. package/src/LayoutBuilder.js +997 -0
  70. package/src/Line.js +114 -0
  71. package/src/OutputDocument.js +78 -0
  72. package/src/OutputDocumentServer.js +26 -0
  73. package/src/PDFDocument.js +174 -0
  74. package/src/PageElementWriter.js +160 -0
  75. package/src/PageSize.js +53 -0
  76. package/src/Printer.js +306 -0
  77. package/src/Renderer.js +405 -0
  78. package/src/SVGMeasure.js +79 -0
  79. package/src/StyleContextStack.js +175 -0
  80. package/src/TableProcessor.js +580 -0
  81. package/src/TextBreaker.js +149 -0
  82. package/src/TextDecorator.js +161 -0
  83. package/src/TextInlines.js +223 -0
  84. package/src/URLResolver.js +77 -0
  85. package/src/base.js +61 -0
  86. package/src/browser-extensions/OutputDocumentBrowser.js +117 -0
  87. package/src/browser-extensions/URLBrowserResolver.js +45 -57
  88. package/src/browser-extensions/fonts/Roboto.js +27 -0
  89. package/src/browser-extensions/index.js +55 -0
  90. package/src/browser-extensions/pdfMake.js +1 -329
  91. package/src/browser-extensions/standard-fonts/Courier.js +27 -0
  92. package/src/browser-extensions/standard-fonts/Helvetica.js +27 -0
  93. package/src/browser-extensions/standard-fonts/Symbol.js +21 -0
  94. package/src/browser-extensions/standard-fonts/Times.js +27 -0
  95. package/src/browser-extensions/standard-fonts/ZapfDingbats.js +21 -0
  96. package/src/browser-extensions/virtual-fs-cjs.js +1 -0
  97. package/src/columnCalculator.js +35 -38
  98. package/src/helpers/node.js +110 -0
  99. package/src/helpers/tools.js +39 -0
  100. package/src/helpers/variableType.js +50 -0
  101. package/src/index.js +16 -0
  102. package/src/qrEnc.js +15 -10
  103. package/src/standardPageSizes.js +1 -3
  104. package/src/tableLayouts.js +100 -0
  105. package/src/virtual-fs.js +66 -0
  106. package/standard-fonts/Courier.js +8 -0
  107. package/standard-fonts/Helvetica.js +9 -0
  108. package/standard-fonts/Symbol.js +5 -0
  109. package/standard-fonts/Times.js +8 -0
  110. package/standard-fonts/ZapfDingbats.js +5 -0
  111. package/.idea/codeStyles/Project.xml +0 -7
  112. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  113. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  114. package/.idea/misc.xml +0 -6
  115. package/.idea/modules.xml +0 -8
  116. package/.idea/pdfmake.iml +0 -11
  117. package/.idea/vcs.xml +0 -6
  118. package/src/browser-extensions/virtual-fs.js +0 -55
  119. package/src/docMeasure.js +0 -810
  120. package/src/docPreprocessor.js +0 -255
  121. package/src/documentContext.js +0 -328
  122. package/src/elementWriter.js +0 -333
  123. package/src/fontProvider.js +0 -68
  124. package/src/helpers.js +0 -138
  125. package/src/imageMeasure.js +0 -55
  126. package/src/layoutBuilder.js +0 -989
  127. package/src/line.js +0 -91
  128. package/src/pageElementWriter.js +0 -174
  129. package/src/pdfKitEngine.js +0 -21
  130. package/src/printer.js +0 -710
  131. package/src/styleContextStack.js +0 -138
  132. package/src/svgMeasure.js +0 -70
  133. package/src/tableProcessor.js +0 -584
  134. package/src/textDecorator.js +0 -157
  135. package/src/textTools.js +0 -373
  136. package/src/traversalTracker.js +0 -47
@@ -0,0 +1,66 @@
1
+ const normalizeFilename = filename => {
2
+ if (filename.indexOf(__dirname) === 0) {
3
+ filename = filename.substring(__dirname.length);
4
+ }
5
+
6
+ if (filename.indexOf('/') === 0) {
7
+ filename = filename.substring(1);
8
+ }
9
+
10
+ return filename;
11
+ };
12
+
13
+ class VirtualFileSystem {
14
+ constructor() {
15
+ this.storage = {};
16
+ }
17
+
18
+ /**
19
+ * @param {string} filename
20
+ * @returns {boolean}
21
+ */
22
+ existsSync(filename) {
23
+ const normalizedFilename = normalizeFilename(filename);
24
+ return typeof this.storage[normalizedFilename] !== 'undefined';
25
+ }
26
+
27
+ /**
28
+ * @param {string} filename
29
+ * @param {?string|?object} options
30
+ * @returns {string|Buffer}
31
+ */
32
+ readFileSync(filename, options) {
33
+ const normalizedFilename = normalizeFilename(filename);
34
+ const encoding = typeof options === 'object' ? options.encoding : options;
35
+
36
+ if (!this.existsSync(normalizedFilename)) {
37
+ throw new Error(`File '${normalizedFilename}' not found in virtual file system`);
38
+ }
39
+
40
+ const buffer = this.storage[normalizedFilename];
41
+ if (encoding) {
42
+ return buffer.toString(encoding);
43
+ }
44
+
45
+ return buffer;
46
+ }
47
+
48
+ /**
49
+ * @param {string} filename
50
+ * @param {string|Buffer} content
51
+ * @param {?string|?object} options
52
+ */
53
+ writeFileSync(filename, content, options) {
54
+ const normalizedFilename = normalizeFilename(filename);
55
+ const encoding = typeof options === 'object' ? options.encoding : options;
56
+
57
+ if (!content && !options) {
58
+ throw new Error('No content');
59
+ }
60
+
61
+ this.storage[normalizedFilename] = encoding || typeof content === 'string' ? new Buffer(content, encoding) : content;
62
+ }
63
+
64
+ }
65
+
66
+ export default new VirtualFileSystem();
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ Courier: {
3
+ normal: 'Courier',
4
+ bold: 'Courier-Bold',
5
+ italics: 'Courier-Oblique',
6
+ bolditalics: 'Courier-BoldOblique'
7
+ }
8
+ };
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ Helvetica: {
3
+ normal: 'Helvetica',
4
+ bold: 'Helvetica-Bold',
5
+ italics: 'Helvetica-Oblique',
6
+ bolditalics: 'Helvetica-BoldOblique'
7
+ }
8
+ };
9
+
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ Symbol: {
3
+ normal: 'Symbol'
4
+ }
5
+ };
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ Times: {
3
+ normal: 'Times-Roman',
4
+ bold: 'Times-Bold',
5
+ italics: 'Times-Italic',
6
+ bolditalics: 'Times-BoldItalic'
7
+ }
8
+ };
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ ZapfDingbats: {
3
+ normal: 'ZapfDingbats'
4
+ }
5
+ };
@@ -1,7 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <code_scheme name="Project" version="173">
3
- <JSCodeStyleSettings version="0">
4
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
5
- </JSCodeStyleSettings>
6
- </code_scheme>
7
- </component>
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
- </state>
5
- </component>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="WebPackConfiguration">
4
- <option name="mode" value="DISABLED" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/pdfmake.iml" filepath="$PROJECT_DIR$/.idea/pdfmake.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/pdfmake.iml DELETED
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
6
- <sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
7
- </content>
8
- <orderEntry type="inheritedJdk" />
9
- <orderEntry type="sourceFolder" forTests="false" />
10
- </component>
11
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,55 +0,0 @@
1
- 'use strict';
2
-
3
- function VirtualFileSystem() {
4
- this.fileSystem = {};
5
- this.dataSystem = {};
6
- }
7
-
8
- VirtualFileSystem.prototype.existsSync = function (filename) {
9
- filename = fixFilename(filename);
10
- return typeof this.fileSystem[filename] !== 'undefined'
11
- || typeof this.dataSystem[filename] !== 'undefined';
12
- };
13
-
14
- VirtualFileSystem.prototype.readFileSync = function (filename, options) {
15
- filename = fixFilename(filename);
16
-
17
- var dataContent = this.dataSystem[filename];
18
- if (typeof dataContent === 'string' && options === 'utf8') {
19
- return dataContent;
20
- }
21
-
22
- if (dataContent) {
23
- return new Buffer(dataContent, typeof dataContent === 'string' ? 'base64' : undefined);
24
- }
25
-
26
- var content = this.fileSystem[filename];
27
- if (content) {
28
- return content;
29
- }
30
-
31
- throw 'File \'' + filename + '\' not found in virtual file system';
32
- };
33
-
34
- VirtualFileSystem.prototype.writeFileSync = function (filename, content) {
35
- this.fileSystem[fixFilename(filename)] = content;
36
- };
37
-
38
- VirtualFileSystem.prototype.bindFS = function (data) {
39
- this.dataSystem = data || {};
40
- };
41
-
42
-
43
- function fixFilename(filename) {
44
- if (filename.indexOf(__dirname) === 0) {
45
- filename = filename.substring(__dirname.length);
46
- }
47
-
48
- if (filename.indexOf('/') === 0) {
49
- filename = filename.substring(1);
50
- }
51
-
52
- return filename;
53
- }
54
-
55
- module.exports = new VirtualFileSystem();