@digicole/pdfmake-rtl 2.1.0 → 2.1.2

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 (65) hide show
  1. package/CHANGELOG.md +118 -83
  2. package/README.md +11 -10
  3. package/build/pdfmake.js +71 -42
  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/vfs_fonts.js +11 -11
  8. package/js/3rd-party/svg-to-pdfkit/source.js +3823 -0
  9. package/js/3rd-party/svg-to-pdfkit.js +7 -0
  10. package/js/DocMeasure.js +713 -0
  11. package/js/DocPreprocessor.js +275 -0
  12. package/js/DocumentContext.js +310 -0
  13. package/js/ElementWriter.js +687 -0
  14. package/js/LayoutBuilder.js +1240 -0
  15. package/js/Line.js +113 -0
  16. package/js/OutputDocument.js +64 -0
  17. package/js/OutputDocumentServer.js +29 -0
  18. package/js/PDFDocument.js +144 -0
  19. package/js/PageElementWriter.js +161 -0
  20. package/js/PageSize.js +74 -0
  21. package/js/Printer.js +351 -0
  22. package/js/Renderer.js +417 -0
  23. package/js/SVGMeasure.js +92 -0
  24. package/js/StyleContextStack.js +191 -0
  25. package/js/TableProcessor.js +575 -0
  26. package/js/TextBreaker.js +166 -0
  27. package/js/TextDecorator.js +152 -0
  28. package/js/TextInlines.js +244 -0
  29. package/js/URLResolver.js +43 -0
  30. package/js/base.js +59 -0
  31. package/js/browser-extensions/OutputDocumentBrowser.js +82 -0
  32. package/js/browser-extensions/fonts/Cairo.js +38 -0
  33. package/js/browser-extensions/fonts/Roboto.js +38 -0
  34. package/js/browser-extensions/index.js +59 -0
  35. package/js/browser-extensions/pdfMake.js +3 -0
  36. package/js/browser-extensions/standard-fonts/Courier.js +38 -0
  37. package/js/browser-extensions/standard-fonts/Helvetica.js +38 -0
  38. package/js/browser-extensions/standard-fonts/Symbol.js +23 -0
  39. package/js/browser-extensions/standard-fonts/Times.js +38 -0
  40. package/js/browser-extensions/standard-fonts/ZapfDingbats.js +23 -0
  41. package/js/browser-extensions/virtual-fs-cjs.js +3 -0
  42. package/js/columnCalculator.js +148 -0
  43. package/js/helpers/node.js +123 -0
  44. package/js/helpers/tools.js +46 -0
  45. package/js/helpers/variableType.js +59 -0
  46. package/js/index.js +15 -0
  47. package/js/qrEnc.js +721 -0
  48. package/js/rtlUtils.js +519 -0
  49. package/js/standardPageSizes.js +56 -0
  50. package/js/tableLayouts.js +98 -0
  51. package/js/virtual-fs.js +60 -0
  52. package/package.json +1 -1
  53. package/src/{docMeasure.js → DocMeasure.js} +8 -8
  54. package/src/{elementWriter.js → ElementWriter.js} +3 -3
  55. package/src/{layoutBuilder.js → LayoutBuilder.js} +1406 -1393
  56. package/src/{tableProcessor.js → TableProcessor.js} +633 -620
  57. package/src/rtlUtils.js +503 -500
  58. /package/src/{docPreprocessor.js → DocPreprocessor.js} +0 -0
  59. /package/src/{documentContext.js → DocumentContext.js} +0 -0
  60. /package/src/{line.js → Line.js} +0 -0
  61. /package/src/{pageElementWriter.js → PageElementWriter.js} +0 -0
  62. /package/src/{printer.js → Printer.js} +0 -0
  63. /package/src/{svgMeasure.js → SVGMeasure.js} +0 -0
  64. /package/src/{styleContextStack.js → StyleContextStack.js} +0 -0
  65. /package/src/{textDecorator.js → TextDecorator.js} +0 -0
package/js/rtlUtils.js ADDED
@@ -0,0 +1,519 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.applyRTLToNode = applyRTLToNode;
5
+ exports.containsRTL = containsRTL;
6
+ exports.fixArabicTextUsingReplace = fixArabicTextUsingReplace;
7
+ exports.getTextDirection = getTextDirection;
8
+ exports.isArabicChar = isArabicChar;
9
+ exports.isLTRChar = isLTRChar;
10
+ exports.isPersianChar = isPersianChar;
11
+ exports.isRTLChar = isRTLChar;
12
+ exports.isUrduChar = isUrduChar;
13
+ exports.processRTLElement = processRTLElement;
14
+ exports.processRTLList = processRTLList;
15
+ exports.processRTLTable = processRTLTable;
16
+ /**
17
+ * RTL (Right-to-Left) utilities for handling Arabic, Persian (Farsi), and Urdu languages
18
+ * Production-ready module for pdfmake RTL support
19
+ */
20
+
21
+ // Unicode ranges for Arabic script (includes Persian and Urdu characters)
22
+ const ARABIC_RANGE = [[0x0600, 0x06FF],
23
+ // Arabic block
24
+ [0x0750, 0x077F],
25
+ // Arabic Supplement
26
+ [0x08A0, 0x08FF],
27
+ // Arabic Extended-A
28
+ [0xFB50, 0xFDFF],
29
+ // Arabic Presentation Forms-A
30
+ [0xFE70, 0xFEFF] // Arabic Presentation Forms-B
31
+ ];
32
+
33
+ // Unicode ranges for Persian (Farsi) specific characters
34
+ const PERSIAN_RANGE = [[0x06A9, 0x06AF],
35
+ // Persian Kaf, Gaf
36
+ [0x06C0, 0x06C3],
37
+ // Persian Heh, Marbuta variants
38
+ [0x06CC, 0x06CE],
39
+ // Persian Yeh variants
40
+ [0x06D0, 0x06D5],
41
+ // Persian Yeh Barree, Arabic-Indic digits
42
+ [0x200C, 0x200D] // Zero Width Non-Joiner, Zero Width Joiner (used in Persian)
43
+ ];
44
+
45
+ // Unicode ranges for Urdu specific characters
46
+ const URDU_RANGE = [[0x0679, 0x0679],
47
+ // Urdu Tteh
48
+ [0x067E, 0x067E],
49
+ // Urdu Peh
50
+ [0x0686, 0x0686],
51
+ // Urdu Tcheh
52
+ [0x0688, 0x0688],
53
+ // Urdu Ddal
54
+ [0x0691, 0x0691],
55
+ // Urdu Rreh
56
+ [0x0698, 0x0698],
57
+ // Urdu Jeh
58
+ [0x06A9, 0x06A9],
59
+ // Urdu Keheh
60
+ [0x06AF, 0x06AF],
61
+ // Urdu Gaf
62
+ [0x06BA, 0x06BA],
63
+ // Urdu Noon Ghunna
64
+ [0x06BE, 0x06BE],
65
+ // Urdu Heh Doachashmee
66
+ [0x06C1, 0x06C1],
67
+ // Urdu Heh Goal
68
+ [0x06D2, 0x06D2],
69
+ // Urdu Yeh Barree
70
+ [0x06D3, 0x06D3] // Urdu Yeh Barree with Hamza
71
+ ];
72
+
73
+ // Strong RTL characters (Arabic, Persian, Urdu)
74
+ const RTL_CHARS = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF\u200C-\u200D]/;
75
+
76
+ // Strong LTR characters (Latin, etc.)
77
+ const LTR_CHARS = /[A-Za-z\u00C0-\u024F\u1E00-\u1EFF]/;
78
+
79
+ /**
80
+ * Check if a character is in Arabic script (includes Persian and Urdu)
81
+ * @param {string} char - Single character to check
82
+ * @returns {boolean} - True if character is Arabic/Persian/Urdu
83
+ */
84
+ function isArabicChar(char) {
85
+ const code = char.charCodeAt(0);
86
+ return ARABIC_RANGE.some(range => code >= range[0] && code <= range[1]);
87
+ }
88
+
89
+ /**
90
+ * Check if a character is in Persian (Farsi) script
91
+ * @param {string} char - Single character to check
92
+ * @returns {boolean} - True if character is Persian
93
+ */
94
+ function isPersianChar(char) {
95
+ const code = char.charCodeAt(0);
96
+ return PERSIAN_RANGE.some(range => code >= range[0] && code <= range[1]) || isArabicChar(char);
97
+ }
98
+
99
+ /**
100
+ * Check if a character is in Urdu script
101
+ * @param {string} char - Single character to check
102
+ * @returns {boolean} - True if character is Urdu
103
+ */
104
+ function isUrduChar(char) {
105
+ const code = char.charCodeAt(0);
106
+ return URDU_RANGE.some(range => code >= range[0] && code <= range[1]) || isArabicChar(char);
107
+ }
108
+
109
+ /**
110
+ * Check if a character requires RTL rendering
111
+ * @param {string} char - Single character to check
112
+ * @returns {boolean} - True if character requires RTL
113
+ */
114
+ function isRTLChar(char) {
115
+ return RTL_CHARS.test(char);
116
+ }
117
+
118
+ /**
119
+ * Check if a character is strongly LTR
120
+ * @param {string} char - Single character to check
121
+ * @returns {boolean} - True if character is strongly LTR
122
+ */
123
+ function isLTRChar(char) {
124
+ return LTR_CHARS.test(char);
125
+ }
126
+
127
+ /**
128
+ * Check if text contains any RTL characters
129
+ * @param {string} text - Text to check
130
+ * @returns {boolean} - True if text contains RTL characters
131
+ */
132
+ function containsRTL(text) {
133
+ if (!text || typeof text !== 'string') {
134
+ return false;
135
+ }
136
+ return RTL_CHARS.test(text);
137
+ }
138
+
139
+ /**
140
+ * Determine the predominant text direction of a string
141
+ * @param {string} text - Text to analyze
142
+ * @returns {string} - 'rtl', 'ltr', or 'neutral'
143
+ */
144
+ function getTextDirection(text) {
145
+ if (!text || typeof text !== 'string') {
146
+ return 'neutral';
147
+ }
148
+ let rtlCount = 0;
149
+ let ltrCount = 0;
150
+ for (let i = 0; i < text.length; i++) {
151
+ const char = text.charAt(i);
152
+ if (isRTLChar(char)) {
153
+ rtlCount++;
154
+ } else if (isLTRChar(char)) {
155
+ ltrCount++;
156
+ }
157
+ }
158
+
159
+ // If we have any strong directional characters
160
+ if (rtlCount > 0 || ltrCount > 0) {
161
+ if (rtlCount > ltrCount) {
162
+ return 'rtl';
163
+ } else if (ltrCount > rtlCount) {
164
+ return 'ltr';
165
+ } else {
166
+ // Equal counts - slight preference for RTL if both exist
167
+ return rtlCount > 0 ? 'rtl' : 'ltr';
168
+ }
169
+ }
170
+ return 'neutral';
171
+ }
172
+
173
+ /**
174
+ * Fix bracket directionality for RTL text
175
+ * Only mirrors brackets that are in RTL context (adjacent to RTL characters)
176
+ * Brackets next to numbers or LTR text are preserved (e.g. "1)" stays as "1)")
177
+ * @param {string} text - Text to process
178
+ * @returns {string} - Text with contextually mirrored brackets
179
+ */
180
+ function fixArabicTextUsingReplace(text) {
181
+ if (!text || typeof text !== 'string') {
182
+ return text;
183
+ }
184
+
185
+ // Remove leading dot if present
186
+ if (text.startsWith('.')) {
187
+ text = text.slice(1);
188
+ }
189
+ const DIGIT_OR_LTR = /[0-9A-Za-z\u00C0-\u024F\u1E00-\u1EFF]/;
190
+ const mirrorMap = {
191
+ '(': ')',
192
+ ')': '(',
193
+ '[': ']',
194
+ ']': '[',
195
+ '{': '}',
196
+ '}': '{',
197
+ '<': '>',
198
+ '>': '<'
199
+ };
200
+ const openBrackets = {
201
+ '(': ')',
202
+ '[': ']',
203
+ '{': '}',
204
+ '<': '>'
205
+ };
206
+
207
+ // --- Pre-pass: find matched bracket pairs ---
208
+ // Any bracket that is part of a balanced open/close pair within the same
209
+ // text should NOT be mirrored, because the PDF engine will display them
210
+ // in visual order and mirroring would invert them.
211
+ let pairedIndices = new Set();
212
+ let stack = [];
213
+ for (let i = 0; i < text.length; i++) {
214
+ let ch = text[i];
215
+ if (openBrackets[ch] !== undefined) {
216
+ stack.push({
217
+ ch: ch,
218
+ idx: i
219
+ });
220
+ } else if (ch === ')' || ch === ']' || ch === '}' || ch === '>') {
221
+ // Find matching opening bracket on stack
222
+ for (let s = stack.length - 1; s >= 0; s--) {
223
+ if (openBrackets[stack[s].ch] === ch) {
224
+ pairedIndices.add(stack[s].idx);
225
+ pairedIndices.add(i);
226
+ stack.splice(s, 1);
227
+ break;
228
+ }
229
+ }
230
+ }
231
+ }
232
+ let result = '';
233
+ for (let i = 0; i < text.length; i++) {
234
+ const ch = text[i];
235
+ if (mirrorMap[ch] !== undefined) {
236
+ // If this bracket is part of a balanced pair, do NOT mirror it
237
+ if (pairedIndices.has(i)) {
238
+ result += ch;
239
+ continue;
240
+ }
241
+
242
+ // Find the previous non-space character
243
+ let prevChar = null;
244
+ for (let j = i - 1; j >= 0; j--) {
245
+ if (text[j] !== ' ') {
246
+ prevChar = text[j];
247
+ break;
248
+ }
249
+ }
250
+ // Find the next non-space character
251
+ let nextChar = null;
252
+ for (let j = i + 1; j < text.length; j++) {
253
+ if (text[j] !== ' ') {
254
+ nextChar = text[j];
255
+ break;
256
+ }
257
+ }
258
+
259
+ // If previous char is a digit or LTR letter, bracket belongs to it — don't mirror
260
+ // e.g. "1)" or "a)" — the bracket is part of numbering
261
+ if (prevChar && DIGIT_OR_LTR.test(prevChar)) {
262
+ result += ch;
263
+ }
264
+ // If next char is a digit or LTR letter and no RTL before, don't mirror
265
+ // e.g. "(Hello"
266
+ else if (!prevChar && nextChar && DIGIT_OR_LTR.test(nextChar)) {
267
+ result += ch;
268
+ }
269
+ // Otherwise mirror — bracket is in RTL context (unpaired bracket)
270
+ else {
271
+ result += mirrorMap[ch];
272
+ }
273
+ } else {
274
+ result += ch;
275
+ }
276
+ }
277
+ return result;
278
+ }
279
+
280
+ /**
281
+ * Apply RTL properties to a node
282
+ * @param {object} node - Document node
283
+ * @param {boolean} forceRTL - Force RTL regardless of content
284
+ * @returns {object} - Node with RTL properties applied
285
+ */
286
+ function applyRTLToNode(node, forceRTL = false) {
287
+ if (!node || typeof node !== 'object') {
288
+ return node;
289
+ }
290
+
291
+ // Determine if node should be RTL
292
+ let shouldBeRTL = forceRTL;
293
+ if (!forceRTL && node.text) {
294
+ const textStr = typeof node.text === 'string' ? node.text : Array.isArray(node.text) ? node.text.join('') : '';
295
+ shouldBeRTL = getTextDirection(textStr) === 'rtl';
296
+ }
297
+ if (shouldBeRTL) {
298
+ // Set structural RTL properties (alignment)
299
+ // Font is resolved later by TextInlines.measure with priority:
300
+ // item font > style font > defaultStyle font > auto-detect (Cairo for RTL, Roboto for LTR)
301
+ // Text shaping (bracket mirroring) is handled at render time in ElementWriter
302
+ if (!node.alignment) {
303
+ node.alignment = 'right';
304
+ }
305
+ }
306
+ return node;
307
+ }
308
+
309
+ /**
310
+ * Process table for RTL layout
311
+ * @param {object} tableNode - Table definition object
312
+ * @param {boolean} forceRTL - Force RTL layout
313
+ * @returns {object} - Processed table node
314
+ */
315
+ /**
316
+ * Reverse a table row for RTL layout, correctly handling colSpan groups.
317
+ * A colSpan cell and its trailing empty placeholders ({}) are kept together
318
+ * as a single logical group and reversed as a unit.
319
+ * @param {Array} row - Table row array
320
+ * @returns {Array} - Reversed row
321
+ */
322
+ function reverseTableRow(row) {
323
+ // Build logical groups: each group is either a single cell or a colSpan cell + its placeholders
324
+ let groups = [];
325
+ let i = 0;
326
+ while (i < row.length) {
327
+ let cell = row[i];
328
+ let span = cell && typeof cell === 'object' && cell.colSpan && cell.colSpan > 1 ? cell.colSpan : 1;
329
+ let group = row.slice(i, i + span);
330
+ groups.push(group);
331
+ i += span;
332
+ }
333
+ // Reverse the groups, then flatten back to a single array
334
+ groups.reverse();
335
+ let result = [];
336
+ for (let g = 0; g < groups.length; g++) {
337
+ for (let k = 0; k < groups[g].length; k++) {
338
+ result.push(groups[g][k]);
339
+ }
340
+ }
341
+ return result;
342
+ }
343
+ function processRTLTable(tableNode, forceRTL = false) {
344
+ if (!tableNode || !tableNode.table || !tableNode.table.body) {
345
+ return tableNode;
346
+ }
347
+
348
+ // Support rtl: true directly on the table object: table: { rtl: true, body: [...] }
349
+ // This forces RTL layout regardless of content detection
350
+ if (tableNode.table.rtl === true) {
351
+ forceRTL = true;
352
+ }
353
+
354
+ // Determine if table should be RTL
355
+ let shouldBeRTL = forceRTL;
356
+ if (!forceRTL) {
357
+ // Auto-detect based on content
358
+ let rtlCellCount = 0;
359
+ let totalCells = 0;
360
+ tableNode.table.body.forEach(row => {
361
+ if (Array.isArray(row)) {
362
+ row.forEach(cell => {
363
+ totalCells++;
364
+ const cellText = typeof cell === 'string' ? cell : cell && cell.text ? typeof cell.text === 'string' ? cell.text : String(cell.text) : '';
365
+ if (containsRTL(cellText)) {
366
+ rtlCellCount++;
367
+ }
368
+ });
369
+ }
370
+ });
371
+
372
+ // If more than 30% of cells contain RTL content, treat as RTL table
373
+ shouldBeRTL = totalCells > 0 && rtlCellCount / totalCells >= 0.3;
374
+ }
375
+ if (shouldBeRTL) {
376
+ // Mark the table as RTL for the drawing phase (TableProcessor uses this)
377
+ tableNode.table._rtl = true;
378
+
379
+ // Reverse table columns for RTL layout, handling colSpan correctly
380
+ tableNode.table.body = tableNode.table.body.map(row => {
381
+ if (Array.isArray(row)) {
382
+ return reverseTableRow(row);
383
+ }
384
+ return row;
385
+ });
386
+
387
+ // Reverse widths if defined
388
+ if (tableNode.table.widths && Array.isArray(tableNode.table.widths)) {
389
+ tableNode.table.widths = tableNode.table.widths.slice().reverse();
390
+ }
391
+
392
+ // Apply RTL properties to cells (skip empty span placeholders)
393
+ tableNode.table.body = tableNode.table.body.map(row => {
394
+ if (Array.isArray(row)) {
395
+ return row.map(cell => {
396
+ // Convert string cells to objects so we can set alignment
397
+ if (typeof cell === 'string') {
398
+ return {
399
+ text: cell,
400
+ alignment: 'right'
401
+ };
402
+ }
403
+ // Skip null/undefined
404
+ if (!cell || typeof cell !== 'object') return cell;
405
+ // Skip empty span placeholders {} — they must stay empty for colSpan/rowSpan
406
+ if (Object.keys(cell).length === 0) return cell;
407
+ // Skip cells that are only span markers (e.g. {_span: true})
408
+ if (cell._span) return cell;
409
+ return applyRTLToNode(cell, true);
410
+ });
411
+ }
412
+ return row;
413
+ });
414
+ }
415
+ return tableNode;
416
+ }
417
+
418
+ /**
419
+ * Process list items for RTL support
420
+ * @param {Array} listItems - ul/ol content
421
+ * @param {boolean} forceRTL - Force RTL layout
422
+ * @returns {Array} - Processed list
423
+ */
424
+ function processRTLList(listItems, forceRTL = false) {
425
+ if (!listItems || !Array.isArray(listItems)) {
426
+ return listItems;
427
+ }
428
+ return listItems.map(item => {
429
+ if (typeof item === 'string') {
430
+ const shouldBeRTL = forceRTL || getTextDirection(item) === 'rtl';
431
+ if (shouldBeRTL) {
432
+ return {
433
+ text: item,
434
+ alignment: 'right'
435
+ };
436
+ }
437
+ return item;
438
+ }
439
+ if (typeof item === 'object') {
440
+ const shouldBeRTL = forceRTL || item.text && getTextDirection(String(item.text)) === 'rtl';
441
+ if (shouldBeRTL) {
442
+ item = applyRTLToNode(item, true);
443
+ }
444
+
445
+ // Process nested lists recursively
446
+ if (item.ul) {
447
+ item.ul = processRTLList(item.ul, forceRTL);
448
+ }
449
+ if (item.ol) {
450
+ item.ol = processRTLList(item.ol, forceRTL);
451
+ }
452
+ }
453
+ return item;
454
+ });
455
+ }
456
+
457
+ /**
458
+ * Process document element for RTL support
459
+ * @param {any} element - Document element
460
+ * @param {boolean} forceRTL - Force RTL layout
461
+ * @returns {any} - Processed element
462
+ */
463
+ function processRTLElement(element, forceRTL = false) {
464
+ if (!element) {
465
+ return element;
466
+ }
467
+
468
+ // Handle arrays
469
+ if (Array.isArray(element)) {
470
+ return element.map(item => processRTLElement(item, forceRTL));
471
+ }
472
+
473
+ // Handle strings
474
+ if (typeof element === 'string') {
475
+ const shouldBeRTL = forceRTL || getTextDirection(element) === 'rtl';
476
+ if (shouldBeRTL) {
477
+ return {
478
+ text: element,
479
+ alignment: 'right'
480
+ };
481
+ }
482
+ return element;
483
+ }
484
+
485
+ // Handle objects
486
+ if (typeof element === 'object') {
487
+ // Check for explicit rtl property
488
+ const elementForceRTL = element.rtl === true || forceRTL;
489
+
490
+ // Process text nodes
491
+ if (element.text !== undefined) {
492
+ element = applyRTLToNode(element, elementForceRTL);
493
+ }
494
+
495
+ // Process tables
496
+ if (element.table) {
497
+ element = processRTLTable(element, elementForceRTL);
498
+ }
499
+
500
+ // Process lists
501
+ if (element.ul) {
502
+ element.ul = processRTLList(element.ul, elementForceRTL);
503
+ }
504
+ if (element.ol) {
505
+ element.ol = processRTLList(element.ol, elementForceRTL);
506
+ }
507
+
508
+ // Process columns
509
+ if (element.columns && Array.isArray(element.columns)) {
510
+ element.columns = element.columns.map(col => processRTLElement(col, elementForceRTL));
511
+ }
512
+
513
+ // Process stack
514
+ if (element.stack && Array.isArray(element.stack)) {
515
+ element.stack = element.stack.map(item => processRTLElement(item, elementForceRTL));
516
+ }
517
+ }
518
+ return element;
519
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ var _default = exports.default = {
6
+ '4A0': [4767.87, 6740.79],
7
+ '2A0': [3370.39, 4767.87],
8
+ A0: [2383.94, 3370.39],
9
+ A1: [1683.78, 2383.94],
10
+ A2: [1190.55, 1683.78],
11
+ A3: [841.89, 1190.55],
12
+ A4: [595.28, 841.89],
13
+ A5: [419.53, 595.28],
14
+ A6: [297.64, 419.53],
15
+ A7: [209.76, 297.64],
16
+ A8: [147.40, 209.76],
17
+ A9: [104.88, 147.40],
18
+ A10: [73.70, 104.88],
19
+ B0: [2834.65, 4008.19],
20
+ B1: [2004.09, 2834.65],
21
+ B2: [1417.32, 2004.09],
22
+ B3: [1000.63, 1417.32],
23
+ B4: [708.66, 1000.63],
24
+ B5: [498.90, 708.66],
25
+ B6: [354.33, 498.90],
26
+ B7: [249.45, 354.33],
27
+ B8: [175.75, 249.45],
28
+ B9: [124.72, 175.75],
29
+ B10: [87.87, 124.72],
30
+ C0: [2599.37, 3676.54],
31
+ C1: [1836.85, 2599.37],
32
+ C2: [1298.27, 1836.85],
33
+ C3: [918.43, 1298.27],
34
+ C4: [649.13, 918.43],
35
+ C5: [459.21, 649.13],
36
+ C6: [323.15, 459.21],
37
+ C7: [229.61, 323.15],
38
+ C8: [161.57, 229.61],
39
+ C9: [113.39, 161.57],
40
+ C10: [79.37, 113.39],
41
+ RA0: [2437.80, 3458.27],
42
+ RA1: [1729.13, 2437.80],
43
+ RA2: [1218.90, 1729.13],
44
+ RA3: [864.57, 1218.90],
45
+ RA4: [609.45, 864.57],
46
+ SRA0: [2551.18, 3628.35],
47
+ SRA1: [1814.17, 2551.18],
48
+ SRA2: [1275.59, 1814.17],
49
+ SRA3: [907.09, 1275.59],
50
+ SRA4: [637.80, 907.09],
51
+ EXECUTIVE: [521.86, 756.00],
52
+ FOLIO: [612.00, 936.00],
53
+ LEGAL: [612.00, 1008.00],
54
+ LETTER: [612.00, 792.00],
55
+ TABLOID: [792.00, 1224.00]
56
+ };
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.tableLayouts = exports.defaultTableLayout = void 0;
5
+ /*eslint no-unused-vars: ["error", {"args": "none"}]*/
6
+
7
+ const tableLayouts = exports.tableLayouts = {
8
+ noBorders: {
9
+ hLineWidth(i) {
10
+ return 0;
11
+ },
12
+ vLineWidth(i) {
13
+ return 0;
14
+ },
15
+ paddingLeft(i) {
16
+ return i && 4 || 0;
17
+ },
18
+ paddingRight(i, node) {
19
+ return i < node.table.widths.length - 1 ? 4 : 0;
20
+ }
21
+ },
22
+ headerLineOnly: {
23
+ hLineWidth(i, node) {
24
+ if (i === 0 || i === node.table.body.length) {
25
+ return 0;
26
+ }
27
+ return i === node.table.headerRows ? 2 : 0;
28
+ },
29
+ vLineWidth(i) {
30
+ return 0;
31
+ },
32
+ paddingLeft(i) {
33
+ return i === 0 ? 0 : 8;
34
+ },
35
+ paddingRight(i, node) {
36
+ return i === node.table.widths.length - 1 ? 0 : 8;
37
+ }
38
+ },
39
+ lightHorizontalLines: {
40
+ hLineWidth(i, node) {
41
+ if (i === 0 || i === node.table.body.length) {
42
+ return 0;
43
+ }
44
+ return i === node.table.headerRows ? 2 : 1;
45
+ },
46
+ vLineWidth(i) {
47
+ return 0;
48
+ },
49
+ hLineColor(i) {
50
+ return i === 1 ? 'black' : '#aaa';
51
+ },
52
+ paddingLeft(i) {
53
+ return i === 0 ? 0 : 8;
54
+ },
55
+ paddingRight(i, node) {
56
+ return i === node.table.widths.length - 1 ? 0 : 8;
57
+ }
58
+ }
59
+ };
60
+ const defaultTableLayout = exports.defaultTableLayout = {
61
+ hLineWidth(i, node) {
62
+ return 1;
63
+ },
64
+ vLineWidth(i, node) {
65
+ return 1;
66
+ },
67
+ hLineColor(i, node) {
68
+ return 'black';
69
+ },
70
+ vLineColor(i, node) {
71
+ return 'black';
72
+ },
73
+ hLineStyle(i, node) {
74
+ return null;
75
+ },
76
+ vLineStyle(i, node) {
77
+ return null;
78
+ },
79
+ paddingLeft(i, node) {
80
+ return 4;
81
+ },
82
+ paddingRight(i, node) {
83
+ return 4;
84
+ },
85
+ paddingTop(i, node) {
86
+ return 2;
87
+ },
88
+ paddingBottom(i, node) {
89
+ return 2;
90
+ },
91
+ fillColor(i, node) {
92
+ return null;
93
+ },
94
+ fillOpacity(i, node) {
95
+ return 1;
96
+ },
97
+ defaultBorder: true
98
+ };