pdfmake 0.2.4 → 0.3.0-beta.1

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 (128) hide show
  1. package/CHANGELOG.md +8 -30
  2. package/README.md +8 -6
  3. package/build/pdfmake.js +28921 -26825
  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/fonts/Roboto/Roboto-Italic.ttf +0 -0
  15. package/fonts/Roboto/Roboto-Medium.ttf +0 -0
  16. package/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  17. package/fonts/Roboto/Roboto-Regular.ttf +0 -0
  18. package/fonts/Roboto.js +8 -0
  19. package/js/3rd-party/svg-to-pdfkit/source.js +4301 -0
  20. package/js/3rd-party/svg-to-pdfkit.js +11 -0
  21. package/js/DocMeasure.js +750 -0
  22. package/js/DocPreprocessor.js +285 -0
  23. package/js/DocumentContext.js +306 -0
  24. package/js/ElementWriter.js +377 -0
  25. package/js/LayoutBuilder.js +833 -0
  26. package/js/Line.js +125 -0
  27. package/js/OutputDocument.js +86 -0
  28. package/js/OutputDocumentServer.js +34 -0
  29. package/js/PDFDocument.js +163 -0
  30. package/js/PageElementWriter.js +161 -0
  31. package/js/PageSize.js +88 -0
  32. package/js/Printer.js +238 -0
  33. package/js/Renderer.js +433 -0
  34. package/js/SVGMeasure.js +89 -0
  35. package/js/StyleContextStack.js +206 -0
  36. package/js/TableProcessor.js +590 -0
  37. package/js/TextBreaker.js +182 -0
  38. package/js/TextDecorator.js +181 -0
  39. package/js/TextInlines.js +248 -0
  40. package/js/URLResolver.js +79 -0
  41. package/js/base.js +69 -0
  42. package/js/browser-extensions/OutputDocumentBrowser.js +131 -0
  43. package/js/browser-extensions/URLBrowserResolver.js +89 -0
  44. package/js/browser-extensions/fonts/Roboto.js +42 -0
  45. package/js/browser-extensions/index.js +70 -0
  46. package/js/browser-extensions/pdfMake.js +17 -0
  47. package/js/browser-extensions/standard-fonts/Courier.js +42 -0
  48. package/js/browser-extensions/standard-fonts/Helvetica.js +42 -0
  49. package/js/browser-extensions/standard-fonts/Symbol.js +27 -0
  50. package/js/browser-extensions/standard-fonts/Times.js +42 -0
  51. package/js/browser-extensions/standard-fonts/ZapfDingbats.js +27 -0
  52. package/js/browser-extensions/virtual-fs-cjs.js +3 -0
  53. package/js/columnCalculator.js +142 -0
  54. package/js/helpers/node.js +122 -0
  55. package/js/helpers/tools.js +48 -0
  56. package/js/helpers/variableType.js +52 -0
  57. package/js/index.js +21 -0
  58. package/js/qrEnc.js +810 -0
  59. package/js/standardPageSizes.js +57 -0
  60. package/js/tableLayouts.js +127 -0
  61. package/js/virtual-fs.js +77 -0
  62. package/package.json +26 -22
  63. package/src/3rd-party/svg-to-pdfkit.js +2 -2
  64. package/src/DocMeasure.js +694 -0
  65. package/src/DocPreprocessor.js +258 -0
  66. package/src/DocumentContext.js +309 -0
  67. package/src/ElementWriter.js +368 -0
  68. package/src/LayoutBuilder.js +814 -0
  69. package/src/Line.js +114 -0
  70. package/src/OutputDocument.js +78 -0
  71. package/src/OutputDocumentServer.js +26 -0
  72. package/src/PDFDocument.js +148 -0
  73. package/src/PageElementWriter.js +156 -0
  74. package/src/PageSize.js +53 -0
  75. package/src/Printer.js +220 -0
  76. package/src/Renderer.js +370 -0
  77. package/src/SVGMeasure.js +79 -0
  78. package/src/StyleContextStack.js +216 -0
  79. package/src/TableProcessor.js +558 -0
  80. package/src/TextBreaker.js +149 -0
  81. package/src/TextDecorator.js +161 -0
  82. package/src/TextInlines.js +223 -0
  83. package/src/URLResolver.js +69 -0
  84. package/src/base.js +61 -0
  85. package/src/browser-extensions/OutputDocumentBrowser.js +117 -0
  86. package/src/browser-extensions/URLBrowserResolver.js +46 -53
  87. package/src/browser-extensions/fonts/Roboto.js +27 -0
  88. package/src/browser-extensions/index.js +55 -0
  89. package/src/browser-extensions/pdfMake.js +10 -282
  90. package/src/browser-extensions/standard-fonts/Courier.js +27 -0
  91. package/src/browser-extensions/standard-fonts/Helvetica.js +27 -0
  92. package/src/browser-extensions/standard-fonts/Symbol.js +21 -0
  93. package/src/browser-extensions/standard-fonts/Times.js +27 -0
  94. package/src/browser-extensions/standard-fonts/ZapfDingbats.js +21 -0
  95. package/src/browser-extensions/virtual-fs-cjs.js +1 -0
  96. package/src/columnCalculator.js +29 -32
  97. package/src/helpers/node.js +110 -0
  98. package/src/helpers/tools.js +39 -0
  99. package/src/helpers/variableType.js +39 -0
  100. package/src/index.js +16 -0
  101. package/src/qrEnc.js +15 -10
  102. package/src/standardPageSizes.js +1 -3
  103. package/src/tableLayouts.js +100 -0
  104. package/src/virtual-fs.js +66 -0
  105. package/standard-fonts/Courier.js +8 -0
  106. package/standard-fonts/Helvetica.js +9 -0
  107. package/standard-fonts/Symbol.js +5 -0
  108. package/standard-fonts/Times.js +8 -0
  109. package/standard-fonts/ZapfDingbats.js +5 -0
  110. package/src/browser-extensions/virtual-fs.js +0 -55
  111. package/src/docMeasure.js +0 -807
  112. package/src/docPreprocessor.js +0 -255
  113. package/src/documentContext.js +0 -314
  114. package/src/elementWriter.js +0 -322
  115. package/src/fontProvider.js +0 -68
  116. package/src/helpers.js +0 -126
  117. package/src/imageMeasure.js +0 -51
  118. package/src/layoutBuilder.js +0 -807
  119. package/src/line.js +0 -91
  120. package/src/pageElementWriter.js +0 -174
  121. package/src/pdfKitEngine.js +0 -21
  122. package/src/printer.js +0 -705
  123. package/src/styleContextStack.js +0 -179
  124. package/src/svgMeasure.js +0 -70
  125. package/src/tableProcessor.js +0 -561
  126. package/src/textDecorator.js +0 -157
  127. package/src/textTools.js +0 -373
  128. package/src/traversalTracker.js +0 -47
@@ -1,46 +1,38 @@
1
- 'use strict';
2
-
3
- // Internet Explorer polyfills
4
- if (typeof window !== 'undefined' && !window.Promise) {
5
- require('core-js/features/promise');
6
- }
7
- require('core-js/es/object/values');
8
-
9
- var fetchUrl = function (url) {
10
- return new Promise(function (resolve, reject) {
11
- var xhr = new XMLHttpRequest();
1
+ const fetchUrl = url => {
2
+ return new Promise((resolve, reject) => {
3
+ const xhr = new XMLHttpRequest();
12
4
  xhr.open('GET', url, true);
13
5
  xhr.responseType = 'arraybuffer';
14
6
 
15
- xhr.onreadystatechange = function () {
7
+ xhr.onreadystatechange = () => {
16
8
  if (xhr.readyState !== 4) {
17
9
  return;
18
10
  }
19
11
 
20
- var ok = xhr.status >= 200 && xhr.status < 300;
12
+ const ok = xhr.status >= 200 && xhr.status < 300;
21
13
  if (!ok) {
22
- setTimeout(function () {
23
- reject(new TypeError('Failed to fetch (url: "' + url + '")'));
14
+ setTimeout(() => {
15
+ reject(new TypeError(`Failed to fetch (url: "${url}")`));
24
16
  }, 0);
25
17
  }
26
18
  };
27
19
 
28
- xhr.onload = function () {
29
- var ok = xhr.status >= 200 && xhr.status < 300;
20
+ xhr.onload = () => {
21
+ const ok = xhr.status >= 200 && xhr.status < 300;
30
22
  if (ok) {
31
23
  resolve(xhr.response);
32
24
  }
33
25
  };
34
26
 
35
- xhr.onerror = function () {
36
- setTimeout(function () {
37
- reject(new TypeError('Network request failed (url: "' + url + '")'));
27
+ xhr.onerror = () => {
28
+ setTimeout(() => {
29
+ reject(new TypeError(`Network request failed (url: "${url}")`));
38
30
  }, 0);
39
31
  };
40
32
 
41
- xhr.ontimeout = function () {
42
- setTimeout(function () {
43
- reject(new TypeError('Network request failed (url: "' + url + '")'));
33
+ xhr.ontimeout = () => {
34
+ setTimeout(() => {
35
+ reject(new TypeError(`Network request failed (url: "${url}")`));
44
36
  }, 0);
45
37
  };
46
38
 
@@ -48,41 +40,42 @@ var fetchUrl = function (url) {
48
40
  });
49
41
  };
50
42
 
51
- function URLBrowserResolver(fs) {
52
- this.fs = fs;
53
- this.resolving = {};
54
- }
43
+ class URLBrowserResolver {
44
+ constructor(fs) {
45
+ this.fs = fs;
46
+ this.resolving = {};
47
+ }
55
48
 
56
- URLBrowserResolver.prototype.resolve = function (url) {
57
- if (!this.resolving[url]) {
58
- var _this = this;
59
- this.resolving[url] = new Promise(function (resolve, reject) {
60
- if (url.toLowerCase().indexOf('https://') === 0 || url.toLowerCase().indexOf('http://') === 0) {
61
- fetchUrl(url).then(function (buffer) {
62
- _this.fs.writeFileSync(url, buffer);
49
+ resolve(url) {
50
+ if (!this.resolving[url]) {
51
+ this.resolving[url] = new Promise((resolve, reject) => {
52
+ if (url.toLowerCase().indexOf('https://') === 0 || url.toLowerCase().indexOf('http://') === 0) {
53
+ fetchUrl(url).then(buffer => {
54
+ this.fs.writeFileSync(url, buffer);
55
+ resolve();
56
+ }, result => {
57
+ reject(result);
58
+ });
59
+ } else {
60
+ // cannot be resolved
63
61
  resolve();
64
- }, function (result) {
65
- reject(result);
66
- });
67
- } else {
68
- // cannot be resolved
62
+ }
63
+ });
64
+ }
65
+
66
+ return this.resolving[url];
67
+ }
68
+
69
+ resolved() {
70
+ return new Promise((resolve, reject) => {
71
+ Promise.all(Object.values(this.resolving)).then(() => {
69
72
  resolve();
70
- }
73
+ }, result => {
74
+ reject(result);
75
+ });
71
76
  });
72
77
  }
73
78
 
74
- return this.resolving[url];
75
- }
76
-
77
- URLBrowserResolver.prototype.resolved = function () {
78
- var _this = this;
79
- return new Promise(function (resolve, reject) {
80
- Promise.all(Object.values(_this.resolving)).then(function () {
81
- resolve();
82
- }, function (result) {
83
- reject(result);
84
- });
85
- });
86
79
  }
87
80
 
88
- module.exports = URLBrowserResolver;
81
+ export default URLBrowserResolver;
@@ -0,0 +1,27 @@
1
+ var fs = require('fs');
2
+
3
+ var fontContainer = {
4
+ vfs: {
5
+ 'Roboto-Regular.ttf': { data: fs.readFileSync(__dirname + '/../../../fonts/Roboto/Roboto-Regular.ttf', 'base64'), encoding: 'base64' },
6
+ 'Roboto-Medium.ttf': { data: fs.readFileSync(__dirname + '/../../../fonts/Roboto/Roboto-Medium.ttf', 'base64'), encoding: 'base64' },
7
+ 'Roboto-Italic.ttf': { data: fs.readFileSync(__dirname + '/../../../fonts/Roboto/Roboto-Italic.ttf', 'base64'), encoding: 'base64' },
8
+ 'Roboto-MediumItalic.ttf': { data: fs.readFileSync(__dirname + '/../../../fonts/Roboto/Roboto-MediumItalic.ttf', 'base64'), encoding: 'base64' }
9
+ },
10
+ fonts: {
11
+ Roboto: {
12
+ normal: 'Roboto-Regular.ttf',
13
+ bold: 'Roboto-Medium.ttf',
14
+ italics: 'Roboto-Italic.ttf',
15
+ bolditalics: 'Roboto-MediumItalic.ttf'
16
+ }
17
+ }
18
+ };
19
+
20
+ var _global = typeof window === 'object' ? window : typeof global === 'object' ? global : typeof self === 'object' ? self : this;
21
+ if (typeof _global.pdfMake !== 'undefined' && typeof _global.pdfMake.addFontContainer !== 'undefined') {
22
+ _global.pdfMake.addFontContainer(fontContainer);
23
+ }
24
+
25
+ if (typeof module !== 'undefined') {
26
+ module.exports = fontContainer;
27
+ }
@@ -0,0 +1,55 @@
1
+ import pdfmakeBase from '../base';
2
+ import OutputDocumentBrowser from './OutputDocumentBrowser';
3
+ import URLBrowserResolver from './URLBrowserResolver';
4
+ import fs from 'fs';
5
+ import configurator from 'core-js/configurator';
6
+
7
+ // core-js: Polyfills will be used only if natives completely unavailable.
8
+ configurator({
9
+ useNative: ['Promise']
10
+ });
11
+
12
+ let defaultClientFonts = {
13
+ Roboto: {
14
+ normal: 'Roboto-Regular.ttf',
15
+ bold: 'Roboto-Medium.ttf',
16
+ italics: 'Roboto-Italic.ttf',
17
+ bolditalics: 'Roboto-MediumItalic.ttf'
18
+ }
19
+ };
20
+
21
+ class pdfmake extends pdfmakeBase {
22
+ constructor() {
23
+ super();
24
+ this.urlResolver = new URLBrowserResolver(this.virtualfs);
25
+ this.fonts = defaultClientFonts;
26
+ }
27
+
28
+ addFontContainer(fontContainer) {
29
+ this.addVirtualFileSystem(fontContainer.vfs);
30
+ this.addFonts(fontContainer.fonts);
31
+ }
32
+
33
+ addVirtualFileSystem(vfs) {
34
+ for (let key in vfs) {
35
+ if (vfs.hasOwnProperty(key)) {
36
+ let data;
37
+ let encoding;
38
+ if (typeof vfs[key] === 'object') {
39
+ data = vfs[key].data;
40
+ encoding = vfs[key].encoding || 'base64';
41
+ } else {
42
+ data = vfs[key];
43
+ encoding = 'base64';
44
+ }
45
+ fs.writeFileSync(key, data, encoding);
46
+ }
47
+ }
48
+ }
49
+
50
+ _transformToDocument(doc) {
51
+ return new OutputDocumentBrowser(doc);
52
+ }
53
+ }
54
+
55
+ export default new pdfmake();
@@ -1,287 +1,15 @@
1
- 'use strict';
2
-
3
- var isFunction = require('../helpers').isFunction;
4
- var isUndefined = require('../helpers').isUndefined;
5
- var isNull = require('../helpers').isNull;
6
- var FileSaver = require('file-saver');
7
- var saveAs = FileSaver.saveAs;
8
-
9
- var defaultClientFonts = {
10
- Roboto: {
11
- normal: 'Roboto-Regular.ttf',
12
- bold: 'Roboto-Medium.ttf',
13
- italics: 'Roboto-Italic.ttf',
14
- bolditalics: 'Roboto-MediumItalic.ttf'
15
- }
16
- };
17
-
18
- function Document(docDefinition, tableLayouts, fonts, vfs) {
19
- this.docDefinition = docDefinition;
20
- this.tableLayouts = tableLayouts || null;
21
- this.fonts = fonts || defaultClientFonts;
22
- this.vfs = vfs;
23
- }
24
-
25
- function canCreatePdf() {
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
- }
37
-
38
- Document.prototype._createDoc = function (options, cb) {
39
- options = options || {};
40
- if (this.tableLayouts) {
41
- options.tableLayouts = this.tableLayouts;
42
- }
43
-
44
- var PdfPrinter = require('../printer');
45
-
46
- var printer = new PdfPrinter(this.fonts);
47
- require('fs').bindFS(this.vfs); // bind virtual file system to file system
48
-
49
- if (!isFunction(cb)) {
50
- var doc = printer.createPdfKitDocument(this.docDefinition, options);
51
-
52
- return doc;
53
- }
54
-
55
- var URLBrowserResolver = require('./URLBrowserResolver');
56
- var urlResolver = new URLBrowserResolver(require('fs'));
57
-
58
- for (var font in this.fonts) {
59
- if (this.fonts.hasOwnProperty(font)) {
60
- if (this.fonts[font].normal) {
61
- urlResolver.resolve(this.fonts[font].normal);
62
- }
63
- if (this.fonts[font].bold) {
64
- urlResolver.resolve(this.fonts[font].bold);
65
- }
66
- if (this.fonts[font].italics) {
67
- urlResolver.resolve(this.fonts[font].italics);
68
- }
69
- if (this.fonts[font].bolditalics) {
70
- urlResolver.resolve(this.fonts[font].bolditalics);
71
- }
72
- }
73
- }
74
-
75
- if (this.docDefinition.images) {
76
- for (var image in this.docDefinition.images) {
77
- if (this.docDefinition.images.hasOwnProperty(image)) {
78
- urlResolver.resolve(this.docDefinition.images[image]);
79
- }
80
- }
81
- }
82
-
83
- var _this = this;
84
-
85
- urlResolver.resolved().then(function () {
86
- var doc = printer.createPdfKitDocument(_this.docDefinition, options);
87
-
88
- cb(doc);
89
- }, function (result) {
90
- throw result;
91
- });
92
- };
93
-
94
- Document.prototype._flushDoc = function (doc, callback) {
95
- var chunks = [];
96
- var result;
97
-
98
- doc.on('readable', function () {
99
- var chunk;
100
- while ((chunk = doc.read(9007199254740991)) !== null) {
101
- chunks.push(chunk);
102
- }
103
- });
104
- doc.on('end', function () {
105
- result = Buffer.concat(chunks);
106
- callback(result, doc._pdfMakePages);
107
- });
108
- doc.end();
109
- };
110
-
111
- Document.prototype._getPages = function (options, cb) {
112
- if (!cb) {
113
- throw '_getPages is an async method and needs a callback argument';
114
- }
115
- var _this = this;
116
-
117
- this._createDoc(options, function (doc) {
118
- _this._flushDoc(doc, function (ignoreBuffer, pages) {
119
- cb(pages);
120
- });
121
- });
122
- };
123
-
124
- Document.prototype._bufferToBlob = function (buffer) {
125
- var blob;
126
- try {
127
- blob = new Blob([buffer], { type: 'application/pdf' });
128
- } catch (e) {
129
- // Old browser which can't handle it without making it an byte array (ie10)
130
- if (e.name === 'InvalidStateError') {
131
- var byteArray = new Uint8Array(buffer);
132
- blob = new Blob([byteArray.buffer], { type: 'application/pdf' });
133
- }
134
- }
135
-
136
- if (!blob) {
137
- throw 'Could not generate blob';
138
- }
139
-
140
- return blob;
141
- };
142
-
143
- Document.prototype._openWindow = function () {
144
- // we have to open the window immediately and store the reference
145
- // otherwise popup blockers will stop us
146
- var win = window.open('', '_blank');
147
- if (win === null) {
148
- throw 'Open PDF in new window blocked by browser';
149
- }
150
-
151
- return win;
152
- };
153
-
154
- Document.prototype._openPdf = function (options, win) {
155
- if (!win) {
156
- win = this._openWindow();
157
- }
158
- try {
159
- this.getBlob(function (result) {
160
- var urlCreator = window.URL || window.webkitURL;
161
- var pdfUrl = urlCreator.createObjectURL(result);
162
- win.location.href = pdfUrl;
163
-
164
- /* temporarily disabled
165
- if (win !== window) {
166
- setTimeout(function () {
167
- if (isNull(win.window)) { // is closed by AdBlock
168
- window.location.href = pdfUrl; // open in actual window
169
- }
170
- }, 500);
171
- }
172
- */
173
- }, options);
174
- } catch (e) {
175
- win.close();
176
- throw e;
177
- }
178
- };
179
-
180
- Document.prototype.open = function (options, win) {
181
- options = options || {};
182
- options.autoPrint = false;
183
- win = win || null;
184
-
185
- this._openPdf(options, win);
186
- };
187
-
188
-
189
- Document.prototype.print = function (options, win) {
190
- options = options || {};
191
- options.autoPrint = true;
192
- win = win || null;
193
-
194
- this._openPdf(options, win);
195
- };
196
-
197
- /**
198
- * download(defaultFileName = 'file.pdf', cb = null, options = {})
199
- * or
200
- * download(cb, options = {})
201
- */
202
- Document.prototype.download = function (defaultFileName, cb, options) {
203
- if (isFunction(defaultFileName)) {
204
- if (!isUndefined(cb)) {
205
- options = cb;
206
- }
207
- cb = defaultFileName;
208
- defaultFileName = null;
209
- }
210
-
211
- defaultFileName = defaultFileName || 'file.pdf';
212
- this.getBlob(function (result) {
213
- saveAs(result, defaultFileName);
214
-
215
- if (isFunction(cb)) {
216
- cb();
217
- }
218
- }, options);
219
- };
220
-
221
- Document.prototype.getBase64 = function (cb, options) {
222
- if (!cb) {
223
- throw 'getBase64 is an async method and needs a callback argument';
224
- }
225
- this.getBuffer(function (buffer) {
226
- cb(buffer.toString('base64'));
227
- }, options);
228
- };
229
-
230
- Document.prototype.getDataUrl = function (cb, options) {
231
- if (!cb) {
232
- throw 'getDataUrl is an async method and needs a callback argument';
1
+ const isBrowserSupported = () => {
2
+ if ((typeof window === 'undefined') || (typeof window.navigator === 'undefined')) {
3
+ // Enviroment is not browser.
4
+ return true;
233
5
  }
234
- this.getBuffer(function (buffer) {
235
- cb('data:application/pdf;base64,' + buffer.toString('base64'));
236
- }, options);
237
- };
238
6
 
239
- Document.prototype.getBlob = function (cb, options) {
240
- if (!cb) {
241
- throw 'getBlob is an async method and needs a callback argument';
242
- }
243
- var that = this;
244
- this.getBuffer(function (result) {
245
- var blob = that._bufferToBlob(result);
246
- cb(blob);
247
- }, options);
7
+ // Internet Explorer 10 and older is not supported.
8
+ return window.navigator.userAgent.indexOf("MSIE") === -1;
248
9
  };
249
10
 
250
- Document.prototype.getBuffer = function (cb, options) {
251
- if (!cb) {
252
- throw 'getBuffer is an async method and needs a callback argument';
253
- }
254
-
255
- var _this = this;
256
-
257
- this._createDoc(options, function (doc) {
258
- _this._flushDoc(doc, function (buffer) {
259
- cb(buffer);
260
- });
261
- });
262
- };
263
-
264
- Document.prototype.getStream = function (options, cb) {
265
- if (!isFunction(cb)) {
266
- var doc = this._createDoc(options);
267
- return doc;
268
- }
269
-
270
- this._createDoc(options, function (doc) {
271
- cb(doc);
272
- });
273
- };
11
+ if (!isBrowserSupported()) {
12
+ throw new Error('pdfmake: Internet Explorer 10 and older is not supported. Upgrade to version 11 or use modern browser.');
13
+ }
274
14
 
275
- module.exports = {
276
- createPdf: function (docDefinition, tableLayouts, fonts, vfs) {
277
- if (!canCreatePdf()) {
278
- throw 'Your browser does not provide the level of support needed';
279
- }
280
- return new Document(
281
- docDefinition,
282
- tableLayouts || global.pdfMake.tableLayouts,
283
- fonts || global.pdfMake.fonts,
284
- vfs || global.pdfMake.vfs
285
- );
286
- }
287
- };
15
+ module.exports = require('./index').default;
@@ -0,0 +1,27 @@
1
+ var fs = require('fs');
2
+
3
+ var fontContainer = {
4
+ vfs: {
5
+ 'data/Courier.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Courier.afm', 'utf8'), encoding: 'utf8' },
6
+ 'data/Courier-Bold.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Courier-Bold.afm', 'utf8'), encoding: 'utf8' },
7
+ 'data/Courier-Oblique.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Courier-Oblique.afm', 'utf8'), encoding: 'utf8' },
8
+ 'data/Courier-BoldOblique.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Courier-BoldOblique.afm', 'utf8'), encoding: 'utf8' }
9
+ },
10
+ fonts: {
11
+ Courier: {
12
+ normal: 'Courier',
13
+ bold: 'Courier-Bold',
14
+ italics: 'Courier-Oblique',
15
+ bolditalics: 'Courier-BoldOblique'
16
+ }
17
+ }
18
+ };
19
+
20
+ var _global = typeof window === 'object' ? window : typeof global === 'object' ? global : typeof self === 'object' ? self : this;
21
+ if (typeof _global.pdfMake !== 'undefined' && typeof _global.pdfMake.addFontContainer !== 'undefined') {
22
+ _global.pdfMake.addFontContainer(fontContainer);
23
+ }
24
+
25
+ if (typeof module !== 'undefined') {
26
+ module.exports = fontContainer;
27
+ }
@@ -0,0 +1,27 @@
1
+ var fs = require('fs');
2
+
3
+ var fontContainer = {
4
+ vfs: {
5
+ 'data/Helvetica.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Helvetica.afm', 'utf8'), encoding: 'utf8' },
6
+ 'data/Helvetica-Bold.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Helvetica-Bold.afm', 'utf8'), encoding: 'utf8' },
7
+ 'data/Helvetica-Oblique.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Helvetica-Oblique.afm', 'utf8'), encoding: 'utf8' },
8
+ 'data/Helvetica-BoldOblique.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Helvetica-BoldOblique.afm', 'utf8'), encoding: 'utf8' }
9
+ },
10
+ fonts: {
11
+ Helvetica: {
12
+ normal: 'Helvetica',
13
+ bold: 'Helvetica-Bold',
14
+ italics: 'Helvetica-Oblique',
15
+ bolditalics: 'Helvetica-BoldOblique'
16
+ }
17
+ }
18
+ };
19
+
20
+ var _global = typeof window === 'object' ? window : typeof global === 'object' ? global : typeof self === 'object' ? self : this;
21
+ if (typeof _global.pdfMake !== 'undefined' && typeof _global.pdfMake.addFontContainer !== 'undefined') {
22
+ _global.pdfMake.addFontContainer(fontContainer);
23
+ }
24
+
25
+ if (typeof module !== 'undefined') {
26
+ module.exports = fontContainer;
27
+ }
@@ -0,0 +1,21 @@
1
+ var fs = require('fs');
2
+
3
+ var fontContainer = {
4
+ vfs: {
5
+ 'data/Symbol.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Symbol.afm', 'utf8'), encoding: 'utf8' }
6
+ },
7
+ fonts: {
8
+ Symbol: {
9
+ normal: 'Symbol'
10
+ }
11
+ }
12
+ };
13
+
14
+ var _global = typeof window === 'object' ? window : typeof global === 'object' ? global : typeof self === 'object' ? self : this;
15
+ if (typeof _global.pdfMake !== 'undefined' && typeof _global.pdfMake.addFontContainer !== 'undefined') {
16
+ _global.pdfMake.addFontContainer(fontContainer);
17
+ }
18
+
19
+ if (typeof module !== 'undefined') {
20
+ module.exports = fontContainer;
21
+ }
@@ -0,0 +1,27 @@
1
+ var fs = require('fs');
2
+
3
+ var fontContainer = {
4
+ vfs: {
5
+ 'data/Times-Roman.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Times-Roman.afm', 'utf8'), encoding: 'utf8' },
6
+ 'data/Times-Bold.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Times-Bold.afm', 'utf8'), encoding: 'utf8' },
7
+ 'data/Times-Italic.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Times-Italic.afm', 'utf8'), encoding: 'utf8' },
8
+ 'data/Times-BoldItalic.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/Times-BoldItalic.afm', 'utf8'), encoding: 'utf8' }
9
+ },
10
+ fonts: {
11
+ Times: {
12
+ normal: 'Times-Roman',
13
+ bold: 'Times-Bold',
14
+ italics: 'Times-Italic',
15
+ bolditalics: 'Times-BoldItalic'
16
+ }
17
+ }
18
+ };
19
+
20
+ var _global = typeof window === 'object' ? window : typeof global === 'object' ? global : typeof self === 'object' ? self : this;
21
+ if (typeof _global.pdfMake !== 'undefined' && typeof _global.pdfMake.addFontContainer !== 'undefined') {
22
+ _global.pdfMake.addFontContainer(fontContainer);
23
+ }
24
+
25
+ if (typeof module !== 'undefined') {
26
+ module.exports = fontContainer;
27
+ }
@@ -0,0 +1,21 @@
1
+ var fs = require('fs');
2
+
3
+ var fontContainer = {
4
+ vfs: {
5
+ 'data/ZapfDingbats.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/@foliojs-fork/pdfkit/js/data/ZapfDingbats.afm', 'utf8'), encoding: 'utf8' }
6
+ },
7
+ fonts: {
8
+ ZapfDingbats: {
9
+ normal: 'ZapfDingbats'
10
+ }
11
+ }
12
+ };
13
+
14
+ var _global = typeof window === 'object' ? window : typeof global === 'object' ? global : typeof self === 'object' ? self : this;
15
+ if (typeof _global.pdfMake !== 'undefined' && typeof _global.pdfMake.addFontContainer !== 'undefined') {
16
+ _global.pdfMake.addFontContainer(fontContainer);
17
+ }
18
+
19
+ if (typeof module !== 'undefined') {
20
+ module.exports = fontContainer;
21
+ }
@@ -0,0 +1 @@
1
+ module.exports = require('../virtual-fs').default;