@digicole/pdfmake-rtl 1.2.0 → 2.1.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 (100) hide show
  1. package/.vscode/tasks.json +17 -0
  2. package/CHANGELOG.md +83 -128
  3. package/LICENSE +22 -22
  4. package/README.md +188 -681
  5. package/build/fonts/Cairo/Cairo-Black.ttf +0 -0
  6. package/build/fonts/Cairo/Cairo-Bold.ttf +0 -0
  7. package/build/fonts/Cairo/Cairo-ExtraLight.ttf +0 -0
  8. package/build/fonts/Cairo/Cairo-Light.ttf +0 -0
  9. package/build/fonts/Cairo/Cairo-Regular.ttf +0 -0
  10. package/build/fonts/Cairo/Cairo-SemiBold.ttf +0 -0
  11. package/build/fonts/Cairo.js +27 -0
  12. package/build/fonts/Roboto/Roboto-Italic.ttf +0 -0
  13. package/build/fonts/Roboto/Roboto-Medium.ttf +0 -0
  14. package/build/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  15. package/build/fonts/Roboto/Roboto-Regular.ttf +0 -0
  16. package/build/fonts/Roboto.js +27 -0
  17. package/build/pdfmake.js +63736 -71285
  18. package/build/pdfmake.js.map +1 -1
  19. package/build/pdfmake.min.js +2 -2
  20. package/build/pdfmake.min.js.map +1 -1
  21. package/build/standard-fonts/Courier.js +27 -0
  22. package/build/standard-fonts/Helvetica.js +27 -0
  23. package/build/standard-fonts/Symbol.js +21 -0
  24. package/build/standard-fonts/Times.js +27 -0
  25. package/build/standard-fonts/ZapfDingbats.js +21 -0
  26. package/build/vfs_fonts.js +11 -7
  27. package/build-vfs.js +44 -44
  28. package/fonts/Cairo/Cairo-Black.ttf +0 -0
  29. package/fonts/Cairo/Cairo-Bold.ttf +0 -0
  30. package/fonts/Cairo/Cairo-ExtraLight.ttf +0 -0
  31. package/fonts/Cairo/Cairo-Light.ttf +0 -0
  32. package/fonts/Cairo/Cairo-Regular.ttf +0 -0
  33. package/fonts/Cairo/Cairo-SemiBold.ttf +0 -0
  34. package/fonts/Cairo.js +8 -0
  35. package/fonts/Roboto/Roboto-Italic.ttf +0 -0
  36. package/fonts/Roboto/Roboto-Medium.ttf +0 -0
  37. package/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  38. package/fonts/Roboto/Roboto-Regular.ttf +0 -0
  39. package/fonts/Roboto.js +8 -0
  40. package/index.js +26 -26
  41. package/package.json +42 -39
  42. package/src/3rd-party/svg-to-pdfkit/LICENSE +9 -9
  43. package/src/3rd-party/svg-to-pdfkit/source.js +229 -36
  44. package/src/3rd-party/svg-to-pdfkit.js +3 -3
  45. package/src/OutputDocument.js +64 -0
  46. package/src/OutputDocumentServer.js +32 -0
  47. package/src/PDFDocument.js +174 -0
  48. package/src/PageSize.js +53 -0
  49. package/src/Renderer.js +445 -0
  50. package/src/TextBreaker.js +168 -0
  51. package/src/TextInlines.js +263 -0
  52. package/src/URLResolver.js +43 -0
  53. package/src/base.js +70 -0
  54. package/src/browser-extensions/OutputDocumentBrowser.js +80 -0
  55. package/src/browser-extensions/fonts/Cairo.js +27 -0
  56. package/src/browser-extensions/fonts/Roboto.js +27 -0
  57. package/src/browser-extensions/index.js +61 -0
  58. package/src/browser-extensions/pdfMake.js +1 -355
  59. package/src/browser-extensions/standard-fonts/Courier.js +27 -0
  60. package/src/browser-extensions/standard-fonts/Helvetica.js +27 -0
  61. package/src/browser-extensions/standard-fonts/Symbol.js +21 -0
  62. package/src/browser-extensions/standard-fonts/Times.js +27 -0
  63. package/src/browser-extensions/standard-fonts/ZapfDingbats.js +21 -0
  64. package/src/browser-extensions/virtual-fs-cjs.js +1 -0
  65. package/src/columnCalculator.js +154 -157
  66. package/src/docMeasure.js +802 -810
  67. package/src/docPreprocessor.js +306 -273
  68. package/src/documentContext.js +345 -340
  69. package/src/elementWriter.js +736 -411
  70. package/src/helpers/node.js +136 -0
  71. package/src/helpers/tools.js +44 -0
  72. package/src/helpers/variableType.js +50 -0
  73. package/src/index.js +16 -0
  74. package/src/layoutBuilder.js +1393 -1197
  75. package/src/line.js +122 -104
  76. package/src/pageElementWriter.js +187 -174
  77. package/src/printer.js +370 -727
  78. package/src/qrEnc.js +796 -791
  79. package/src/rtlUtils.js +500 -485
  80. package/src/standardPageSizes.js +52 -54
  81. package/src/styleContextStack.js +208 -138
  82. package/src/svgMeasure.js +109 -70
  83. package/src/tableLayouts.js +100 -0
  84. package/src/tableProcessor.js +620 -606
  85. package/src/textDecorator.js +175 -157
  86. package/src/virtual-fs.js +66 -0
  87. package/standard-fonts/Courier.js +8 -0
  88. package/standard-fonts/Helvetica.js +8 -0
  89. package/standard-fonts/Symbol.js +5 -0
  90. package/standard-fonts/Times.js +8 -0
  91. package/standard-fonts/ZapfDingbats.js +5 -0
  92. package/index.html +0 -396
  93. package/src/browser-extensions/URLBrowserResolver.js +0 -96
  94. package/src/browser-extensions/virtual-fs.js +0 -55
  95. package/src/fontProvider.js +0 -68
  96. package/src/helpers.js +0 -138
  97. package/src/imageMeasure.js +0 -62
  98. package/src/pdfKitEngine.js +0 -21
  99. package/src/textTools.js +0 -391
  100. package/src/traversalTracker.js +0 -47
@@ -0,0 +1,61 @@
1
+ import pdfmakeBase from '../base';
2
+ import OutputDocumentBrowser from './OutputDocumentBrowser';
3
+ import URLResolver from '../URLResolver';
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
+ Cairo: {
20
+ normal: 'Cairo-Regular.ttf',
21
+ bold: 'Cairo-Bold.ttf',
22
+ italics: 'Cairo-Regular.ttf',
23
+ bolditalics: 'Cairo-Bold.ttf'
24
+ }
25
+ };
26
+
27
+ class pdfmake extends pdfmakeBase {
28
+ constructor() {
29
+ super();
30
+ this.urlResolver = () => new URLResolver(this.virtualfs);
31
+ this.fonts = defaultClientFonts;
32
+ }
33
+
34
+ addFontContainer(fontContainer) {
35
+ this.addVirtualFileSystem(fontContainer.vfs);
36
+ this.addFonts(fontContainer.fonts);
37
+ }
38
+
39
+ addVirtualFileSystem(vfs) {
40
+ for (let key in vfs) {
41
+ if (vfs.hasOwnProperty(key)) {
42
+ let data;
43
+ let encoding;
44
+ if (typeof vfs[key] === 'object') {
45
+ data = vfs[key].data;
46
+ encoding = vfs[key].encoding || 'base64';
47
+ } else {
48
+ data = vfs[key];
49
+ encoding = 'base64';
50
+ }
51
+ fs.writeFileSync(key, data, encoding);
52
+ }
53
+ }
54
+ }
55
+
56
+ _transformToDocument(doc) {
57
+ return new OutputDocumentBrowser(doc);
58
+ }
59
+ }
60
+
61
+ export default new pdfmake();
@@ -1,355 +1 @@
1
- 'use strict';
2
-
3
- var isFunction = require('../helpers').isFunction;
4
- var isUndefined = require('../helpers').isUndefined;
5
- //var isNull = require('../helpers').isNull;
6
- var pack = require('../helpers').pack;
7
- var FileSaver = require('file-saver');
8
- var saveAs = FileSaver.saveAs;
9
-
10
- var defaultClientFonts = {
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
- var globalVfs;
20
- var globalFonts;
21
- var globalTableLayouts;
22
-
23
- function Document(docDefinition, tableLayouts, fonts, vfs) {
24
- this.docDefinition = docDefinition;
25
- this.tableLayouts = tableLayouts || null;
26
- this.fonts = fonts || defaultClientFonts;
27
- this.vfs = vfs;
28
- }
29
-
30
- function canCreatePdf() {
31
- // Ensure the browser provides the level of support needed
32
- try {
33
- var arr = new Uint8Array(1);
34
- var proto = { foo: function () { return 42; } };
35
- Object.setPrototypeOf(proto, Uint8Array.prototype);
36
- Object.setPrototypeOf(arr, proto);
37
- return arr.foo() === 42;
38
- } catch (e) {
39
- return false;
40
- }
41
- }
42
-
43
- Document.prototype._createDoc = function (options, cb) {
44
- var getExtendedUrl = function (url) {
45
- if (typeof url === 'object') {
46
- return { url: url.url, headers: url.headers };
47
- }
48
-
49
- return { url: url, headers: {} };
50
- };
51
-
52
- options = options || {};
53
- if (this.tableLayouts) {
54
- options.tableLayouts = this.tableLayouts;
55
- }
56
-
57
- var PdfPrinter = require('../printer');
58
-
59
- var printer = new PdfPrinter(this.fonts);
60
- require('fs').bindFS(this.vfs); // bind virtual file system to file system
61
-
62
- if (!isFunction(cb)) {
63
- var doc = printer.createPdfKitDocument(this.docDefinition, options);
64
-
65
- return doc;
66
- }
67
-
68
- var URLBrowserResolver = require('./URLBrowserResolver');
69
- var urlResolver = new URLBrowserResolver(require('fs'));
70
-
71
- for (var font in this.fonts) {
72
- if (this.fonts.hasOwnProperty(font)) {
73
- if (this.fonts[font].normal) {
74
- if (Array.isArray(this.fonts[font].normal)) { // TrueType Collection
75
- var url = getExtendedUrl(this.fonts[font].normal[0]);
76
- urlResolver.resolve(url.url, url.headers);
77
- this.fonts[font].normal[0] = url.url;
78
- } else {
79
- var url = getExtendedUrl(this.fonts[font].normal);
80
- urlResolver.resolve(url.url, url.headers);
81
- this.fonts[font].normal = url.url;
82
- }
83
- }
84
- if (this.fonts[font].bold) {
85
- if (Array.isArray(this.fonts[font].bold)) { // TrueType Collection
86
- var url = getExtendedUrl(this.fonts[font].bold[0]);
87
- urlResolver.resolve(url.url, url.headers);
88
- this.fonts[font].bold[0] = url.url;
89
- } else {
90
- var url = getExtendedUrl(this.fonts[font].bold);
91
- urlResolver.resolve(url.url, url.headers);
92
- this.fonts[font].bold = url.url;
93
- }
94
- }
95
- if (this.fonts[font].italics) {
96
- if (Array.isArray(this.fonts[font].italics)) { // TrueType Collection
97
- var url = getExtendedUrl(this.fonts[font].italics[0]);
98
- urlResolver.resolve(url.url, url.headers);
99
- this.fonts[font].italics[0] = url.url;
100
- } else {
101
- var url = getExtendedUrl(this.fonts[font].italics);
102
- urlResolver.resolve(url.url, url.headers);
103
- this.fonts[font].italics = url.url;
104
- }
105
- }
106
- if (this.fonts[font].bolditalics) {
107
- if (Array.isArray(this.fonts[font].bolditalics)) { // TrueType Collection
108
- var url = getExtendedUrl(this.fonts[font].bolditalics[0]);
109
- urlResolver.resolve(url.url, url.headers);
110
- this.fonts[font].bolditalics[0] = url.url;
111
- } else {
112
- var url = getExtendedUrl(this.fonts[font].bolditalics);
113
- urlResolver.resolve(url.url, url.headers);
114
- this.fonts[font].bolditalics = url.url;
115
- }
116
- }
117
- }
118
- }
119
-
120
- if (this.docDefinition.images) {
121
- for (var image in this.docDefinition.images) {
122
- if (this.docDefinition.images.hasOwnProperty(image)) {
123
- var url = getExtendedUrl(this.docDefinition.images[image]);
124
- urlResolver.resolve(url.url, url.headers);
125
- this.docDefinition.images[image] = url.url;
126
- }
127
- }
128
- }
129
-
130
- var _this = this;
131
-
132
- urlResolver.resolved().then(function () {
133
- var doc = printer.createPdfKitDocument(_this.docDefinition, options);
134
-
135
- cb(doc);
136
- }, function (result) {
137
- throw result;
138
- });
139
- };
140
-
141
- Document.prototype._flushDoc = function (doc, callback) {
142
- var chunks = [];
143
- var result;
144
-
145
- doc.on('readable', function () {
146
- var chunk;
147
- while ((chunk = doc.read(9007199254740991)) !== null) {
148
- chunks.push(chunk);
149
- }
150
- });
151
- doc.on('end', function () {
152
- result = Buffer.concat(chunks);
153
- callback(result, doc._pdfMakePages);
154
- });
155
- doc.end();
156
- };
157
-
158
- Document.prototype._getPages = function (options, cb) {
159
- if (!cb) {
160
- throw '_getPages is an async method and needs a callback argument';
161
- }
162
- var _this = this;
163
-
164
- this._createDoc(options, function (doc) {
165
- _this._flushDoc(doc, function (ignoreBuffer, pages) {
166
- cb(pages);
167
- });
168
- });
169
- };
170
-
171
- Document.prototype._bufferToBlob = function (buffer) {
172
- var blob;
173
- try {
174
- blob = new Blob([buffer], { type: 'application/pdf' });
175
- } catch (e) {
176
- // Old browser which can't handle it without making it an byte array (ie10)
177
- if (e.name === 'InvalidStateError') {
178
- var byteArray = new Uint8Array(buffer);
179
- blob = new Blob([byteArray.buffer], { type: 'application/pdf' });
180
- }
181
- }
182
-
183
- if (!blob) {
184
- throw 'Could not generate blob';
185
- }
186
-
187
- return blob;
188
- };
189
-
190
- Document.prototype._openWindow = function () {
191
- // we have to open the window immediately and store the reference
192
- // otherwise popup blockers will stop us
193
- var win = window.open('', '_blank');
194
- if (win === null) {
195
- throw 'Open PDF in new window blocked by browser';
196
- }
197
-
198
- return win;
199
- };
200
-
201
- Document.prototype._openPdf = function (options, win) {
202
- if (!win) {
203
- win = this._openWindow();
204
- }
205
- try {
206
- this.getBlob(function (result) {
207
- var urlCreator = window.URL || window.webkitURL;
208
- var pdfUrl = urlCreator.createObjectURL(result);
209
- win.location.href = pdfUrl;
210
-
211
- /* temporarily disabled
212
- if (win !== window) {
213
- setTimeout(function () {
214
- if (isNull(win.window)) { // is closed by AdBlock
215
- window.location.href = pdfUrl; // open in actual window
216
- }
217
- }, 500);
218
- }
219
- */
220
- }, options);
221
- } catch (e) {
222
- win.close();
223
- throw e;
224
- }
225
- };
226
-
227
- Document.prototype.open = function (options, win) {
228
- options = options || {};
229
- options.autoPrint = false;
230
- win = win || null;
231
-
232
- this._openPdf(options, win);
233
- };
234
-
235
-
236
- Document.prototype.print = function (options, win) {
237
- options = options || {};
238
- options.autoPrint = true;
239
- win = win || null;
240
-
241
- this._openPdf(options, win);
242
- };
243
-
244
- /**
245
- * download(defaultFileName = 'file.pdf', cb = null, options = {})
246
- * or
247
- * download(cb, options = {})
248
- */
249
- Document.prototype.download = function (defaultFileName, cb, options) {
250
- if (isFunction(defaultFileName)) {
251
- if (!isUndefined(cb)) {
252
- options = cb;
253
- }
254
- cb = defaultFileName;
255
- defaultFileName = null;
256
- }
257
-
258
- defaultFileName = defaultFileName || 'file.pdf';
259
- this.getBlob(function (result) {
260
- saveAs(result, defaultFileName);
261
-
262
- if (isFunction(cb)) {
263
- cb();
264
- }
265
- }, options);
266
- };
267
-
268
- Document.prototype.getBase64 = function (cb, options) {
269
- if (!cb) {
270
- throw 'getBase64 is an async method and needs a callback argument';
271
- }
272
- this.getBuffer(function (buffer) {
273
- cb(buffer.toString('base64'));
274
- }, options);
275
- };
276
-
277
- Document.prototype.getDataUrl = function (cb, options) {
278
- if (!cb) {
279
- throw 'getDataUrl is an async method and needs a callback argument';
280
- }
281
- this.getBuffer(function (buffer) {
282
- cb('data:application/pdf;base64,' + buffer.toString('base64'));
283
- }, options);
284
- };
285
-
286
- Document.prototype.getBlob = function (cb, options) {
287
- if (!cb) {
288
- throw 'getBlob is an async method and needs a callback argument';
289
- }
290
- var that = this;
291
- this.getBuffer(function (result) {
292
- var blob = that._bufferToBlob(result);
293
- cb(blob);
294
- }, options);
295
- };
296
-
297
- Document.prototype.getBuffer = function (cb, options) {
298
- if (!cb) {
299
- throw 'getBuffer is an async method and needs a callback argument';
300
- }
301
-
302
- var _this = this;
303
-
304
- this._createDoc(options, function (doc) {
305
- _this._flushDoc(doc, function (buffer) {
306
- cb(buffer);
307
- });
308
- });
309
- };
310
-
311
- Document.prototype.getStream = function (options, cb) {
312
- if (!isFunction(cb)) {
313
- var doc = this._createDoc(options);
314
- return doc;
315
- }
316
-
317
- this._createDoc(options, function (doc) {
318
- cb(doc);
319
- });
320
- };
321
-
322
- module.exports = {
323
- createPdf: function (docDefinition, tableLayouts, fonts, vfs) {
324
- if (!canCreatePdf()) {
325
- throw 'Your browser does not provide the level of support needed';
326
- }
327
- return new Document(
328
- docDefinition,
329
- tableLayouts || globalTableLayouts || global.pdfMake.tableLayouts,
330
- fonts || globalFonts || global.pdfMake.fonts,
331
- vfs || globalVfs || global.pdfMake.vfs
332
- );
333
- },
334
- addVirtualFileSystem: function (vfs) {
335
- globalVfs = vfs;
336
- },
337
- addFonts: function (fonts) {
338
- globalFonts = pack(globalFonts, fonts);
339
- },
340
- setFonts: function (fonts) {
341
- globalFonts = fonts;
342
- },
343
- clearFonts: function () {
344
- globalFonts = undefined;
345
- },
346
- addTableLayouts: function (tableLayouts) {
347
- globalTableLayouts = pack(globalTableLayouts, tableLayouts);
348
- },
349
- setTableLayouts: function (tableLayouts) {
350
- globalTableLayouts = tableLayouts;
351
- },
352
- clearTableLayouts: function () {
353
- globalTableLayouts = undefined;
354
- }
355
- };
1
+ 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/pdfkit/js/data/Courier.afm', 'utf8'), encoding: 'utf8' },
6
+ 'data/Courier-Bold.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/pdfkit/js/data/Courier-Bold.afm', 'utf8'), encoding: 'utf8' },
7
+ 'data/Courier-Oblique.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/pdfkit/js/data/Courier-Oblique.afm', 'utf8'), encoding: 'utf8' },
8
+ 'data/Courier-BoldOblique.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/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/pdfkit/js/data/Helvetica.afm', 'utf8'), encoding: 'utf8' },
6
+ 'data/Helvetica-Bold.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/pdfkit/js/data/Helvetica-Bold.afm', 'utf8'), encoding: 'utf8' },
7
+ 'data/Helvetica-Oblique.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/pdfkit/js/data/Helvetica-Oblique.afm', 'utf8'), encoding: 'utf8' },
8
+ 'data/Helvetica-BoldOblique.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/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/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/pdfkit/js/data/Times-Roman.afm', 'utf8'), encoding: 'utf8' },
6
+ 'data/Times-Bold.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/pdfkit/js/data/Times-Bold.afm', 'utf8'), encoding: 'utf8' },
7
+ 'data/Times-Italic.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/pdfkit/js/data/Times-Italic.afm', 'utf8'), encoding: 'utf8' },
8
+ 'data/Times-BoldItalic.afm': { data: fs.readFileSync(__dirname + '/../../../node_modules/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/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;