@digicole/pdfmake-rtl 1.2.0 → 2.1.0

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 +186 -683
  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,17 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "label": "run tests",
6
+ "type": "shell",
7
+ "command": "npm",
8
+ "args": [
9
+ "test"
10
+ ],
11
+ "problemMatcher": [
12
+ "$eslint-stylish"
13
+ ],
14
+ "group": "build"
15
+ }
16
+ ]
17
+ }
package/CHANGELOG.md CHANGED
@@ -1,128 +1,83 @@
1
- # Changelog
2
-
3
- ## 0.2.20 - 2025-05-09
4
-
5
- - Fixed text overflow with some non-wrappable texts
6
-
7
- ## 0.2.19 - 2025-04-26
8
-
9
- - Update Roboto font (version 3.011)
10
-
11
- ## 0.2.18 - 2025-01-01
12
-
13
- - Update pdfkit
14
- - Fixed a potential issue in the minimized library when detecting the orientation of JPEG images
15
-
16
- ## 0.2.17 - 2024-12-23
17
-
18
- - Fixed big size pdfmake bundle for browser
19
-
20
- ## 0.2.16 - 2024-12-15
21
-
22
- - Update pdfkit to 0.15.2
23
- - Fixed aspect ratio for image with exif orientation tag
24
- - Fixed font size calculation for watermark if is page orientation is changed
25
-
26
- ## 0.2.15 - 2024-11-02
27
-
28
- - Added support PDF/A and PDF/UA (see [documentation](https://pdfmake.github.io/docs/0.1/document-definition-object/pdfa/))
29
- - Changed Virtual file system (VFS) format for better compatibility with frameworks (backwards compatibility preserved). **For compatibility with frameworks, rebuild VFS required!**
30
- - Browser: Added methods for fonts (`addFonts`, `setFonts`, `clearFonts`)
31
- - Browser: Added methods for table layouts (`addTableLayouts`, `setTableLayouts`, `clearTableLayouts`)
32
- - Added support `link`, `linkToPage` and `linkToDestination` for SVG
33
- - Update pdfkit to 0.15.1
34
- - Fixed bug with how page breaks provoked by cells with rowspan were handled
35
- - Fixed find where previous cell started with row span and col span combination
36
- - Fixed calculating correctly the 'y' at the end of a rowSpan with dontBreakRows
37
-
38
- ## 0.2.14 - 2024-10-09
39
-
40
- - Fixed drawing top horizontal line of the table with page break
41
- - Fixed uncaught Error when rowSpan and dontBreakRows combined
42
-
43
- ## 0.2.13 - 2024-09-22
44
-
45
- - Minimal supported version Node.js 18 LTS
46
- - Update Roboto font (version 3.010)
47
- - Fixed page break in a column group
48
- - Fixed saving margins in an unbreakable block
49
- - Fixed fillColor items in unbreakable blocks
50
- - Fixed calculating correctly the 'y' at the end of a rowSpan with dontBreakRows
51
- - Fixed margins (top/bottom) of nodes and row height are considered for breaking page
52
- - Fixed margins after page break
53
- - Fixed margins of nodes with relativePosition or absolutePosition are ignored and don't interfere with the regular flow of the layout
54
-
55
- ## 0.2.12 - 2024-08-14
56
-
57
- - Fixed error message of bad image definition
58
-
59
- ## 0.2.11 - 2024-08-09
60
-
61
- - Fixed and validates input values headerRows and keepWithHeaderRows
62
- - Fixed numbering nested ordered lists
63
- - Speed up StyleContextStack.autopush() for large tables
64
- - Fixed widths of table columns with percentages
65
- - Fixed storing the correct context in the ending cell of a row span when there were nested column groups (columns or tables)
66
-
67
- ## 0.2.10 - 2024-03-07
68
-
69
- - Removed unused brfs dependency
70
-
71
- ## 0.2.9 - 2024-01-01
72
-
73
- - Added padding option for QR code
74
- - Allow the document language to be specified
75
- - Fixed cover image size inside table
76
- - Fixed "Cannot read properties of undefined (reading 'bottomMost')" if table contains too few rows
77
- - Fixed invalid source-maps in builded js file
78
-
79
- ## 0.2.8 - 2023-11-09
80
-
81
- - Update pdfkit to 0.14.0
82
- - Update Roboto font (version 3.008)
83
-
84
- ## 0.2.7 - 2022-12-17
85
-
86
- - Fixed theoretical vulnerability CVE-2022-46161 (**It was never part of version released as npm package or cdnjs or bower or packagist!**)
87
-
88
- ## 0.2.6 - 2022-10-09
89
-
90
- - Updated Roboto font (version 3.005)
91
- - Fixed calculating auto page height
92
- - Fixed TrueType Collection loading from URL
93
- - Fixed refetching fonts from URL
94
-
95
- ## 0.2.5 - 2022-04-01
96
-
97
- - Support passing headers to request for loading font files and images via URL adresses
98
-
99
- ## 0.2.4 - 2021-11-10
100
-
101
- - Fixed destination path argument in VFS build script.
102
- - Fixed error "Object.isExtensible is not a function" (bug is in core-js version 3.19.1).
103
-
104
- ## 0.2.3 - 2021-11-06
105
-
106
- - Updated [@foliojs-fork/pdfkit](https://github.com/foliojs-fork/pdfkit) to version 0.13.0.
107
- - Tiling pattern support.
108
- - svg-to-pdfkit package moved as built-in. Solve not used installation of pdfkit.
109
- - Fixed passing document metadata.
110
-
111
- ## 0.2.2 - 2021-08-02
112
-
113
- - Fixed compatibility with Internet Explorer 11.
114
-
115
- ## 0.2.1 - 2021-08-02
116
-
117
- - Upgrade Unicode Line Breaking Algorithm (UAX #14) to Unicode 13.0.0.
118
- - Updated [@foliojs-fork/pdfkit](https://github.com/foliojs-fork/pdfkit) to version 0.12.3.
119
- - Updated [@foliojs-fork/linebreak](https://github.com/foliojs-fork/linebreak) to version 1.11.1.
120
-
121
- ## 0.2.0 - 2021-07-05
122
-
123
- - Move to [@foliojs-fork](https://github.com/foliojs-fork) packages with up-to-date dependecies and security bug fixes and others. These are the libraries [@foliojs-fork/fontkit](https://github.com/foliojs-fork/fontkit), [@foliojs-fork/restructure](https://github.com/foliojs-fork/restructure), [@foliojs-fork/linebreak](https://github.com/foliojs-fork/linebreak) which are used in [@foliojs-fork/pdfkit](https://github.com/foliojs-fork/pdfkit).
124
- - Upgrade Unicode Line Breaking Algorithm (UAX #14) to Unicode 12.0.0
125
- - Introduced new `build-vfs.js` script to build virtual file system for fonts (see [documentation](https://pdfmake.github.io/docs/0.1/fonts/custom-fonts-client-side/vfs/)).
126
- - Removed support Node.js 8 and 10. Minimum required version is 12 LTS.
127
- - Removed support Internet Explorer 10. Supported only Internet Explorer 11.
128
- - Removed gulp.
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.1.0] - 2026-02-08
9
+
10
+ ### Added
11
+
12
+ - Major version upgrade with significant architectural improvements
13
+ - Full rewrite of RTL processing pipeline for better performance and reliability
14
+ - Support for RTL list tables with proper right-to-left rendering
15
+ - RTL-aware ordered and unordered list handling within table cells
16
+
17
+ ### Improved
18
+
19
+ - Overall RTL text rendering quality and consistency
20
+ - Performance optimizations for large documents with mixed LTR/RTL content
21
+
22
+ ### Fixed
23
+
24
+ - Fixed mixed character rendering issues with combined LTR/RTL scripts
25
+ - Fixed mixed language text handling for Arabic, Persian, Urdu alongside Latin characters
26
+ - Corrected bidirectional text reordering in mixed-language paragraphs
27
+
28
+ ### Breaking Changes
29
+
30
+ - Major version bump; review migration guide for upgrading from v1.x
31
+
32
+ ## [1.3.6] - 2025-08-08
33
+
34
+ ### Added
35
+
36
+ - Enhanced RTL table handling with improved column reversal for Arabic, Persian, and Urdu text
37
+ - New `reverseTableRowPreserveSpans` function to handle complex table structures with colSpan and rowSpan
38
+ - Automatic RTL detection and processing for tables containing RTL content
39
+ - Support for preserving table header structure in RTL layouts
40
+ - Comprehensive test examples for RTL table scenarios
41
+
42
+ ### Improved
43
+
44
+ - Auto-RTL detection logic now respects explicit `supportRTL: false` setting
45
+ - Better handling of nested table headers with mixed span attributes
46
+ - Enhanced RTL text processing with proper bidirectional text support
47
+ - Improved column reversal algorithm that preserves span relationships
48
+
49
+ ### Fixed
50
+
51
+ - Fixed RTL table header positioning issues with colSpan and rowSpan elements
52
+ - Resolved auto-RTL detection overriding explicit RTL settings
53
+ - Fixed column ordering in complex nested header structures
54
+ - Corrected span placeholder handling in RTL table reversal
55
+
56
+ ### Technical Details
57
+
58
+ - Added `processAutoRTLTable` function for intelligent RTL detection
59
+ - Enhanced `rtlUtils.js` with span-aware reversal algorithms
60
+ - Improved error handling for empty object placeholders in span structures
61
+ - Added comprehensive unit tests for RTL table functionality
62
+
63
+ ### Examples Added
64
+
65
+ - `examples/rtl-nested-header.js` - Demonstrates complex RTL table with nested headers
66
+ - `examples/test-simple-rtl-table.js` - Basic RTL table functionality test
67
+ - `examples/test-no-spans-rtl-table.js` - RTL table without span elements
68
+
69
+ ### Breaking Changes
70
+
71
+ - None. All changes are backward compatible.
72
+
73
+ ### Notes
74
+
75
+ - RTL detection threshold set to 30% RTL content for automatic table reversal
76
+ - Headers with span structures are preserved to maintain layout integrity
77
+ - Cell-level RTL text rendering (`bidi: true`) applied automatically for RTL content
78
+
79
+ ---
80
+
81
+ ## Previous Versions
82
+
83
+ This is the first tracked version of the changelog. For earlier changes, please refer to the git commit history.
package/LICENSE CHANGED
@@ -1,22 +1,22 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014-2015 bpampuch (original PDFMake)
4
- 2016-2025 liborm85 (PDFMake maintenance)
5
- 2025 PDFMake RTL Contributors (RTL extensions)
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy of
8
- this software and associated documentation files (the "Software"), to deal in
9
- the Software without restriction, including without limitation the rights to
10
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11
- the Software, and to permit persons to whom the Software is furnished to do so,
12
- subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014-2015 bpampuch (original PDFMake)
4
+ 2016-2025 liborm85 (PDFMake maintenance)
5
+ 2025 PDFMake RTL Contributors (RTL extensions)
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
8
+ this software and associated documentation files (the "Software"), to deal in
9
+ the Software without restriction, including without limitation the rights to
10
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11
+ the Software, and to permit persons to whom the Software is furnished to do so,
12
+ subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.