pdfxml 0.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 (172) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/CONTRIBUTING.md +152 -0
  3. package/LICENSE +201 -0
  4. package/README.md +140 -0
  5. package/dist/index.d.ts +4 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +23 -0
  8. package/dist/lib/common/applyBoxStyle.d.ts +3 -0
  9. package/dist/lib/common/applyBoxStyle.d.ts.map +1 -0
  10. package/dist/lib/common/applyBoxStyle.js +38 -0
  11. package/dist/lib/common/applyTextStyle.d.ts +3 -0
  12. package/dist/lib/common/applyTextStyle.d.ts.map +1 -0
  13. package/dist/lib/common/applyTextStyle.js +46 -0
  14. package/dist/lib/common/calculateTableColumnWidths.d.ts +3 -0
  15. package/dist/lib/common/calculateTableColumnWidths.d.ts.map +1 -0
  16. package/dist/lib/common/calculateTableColumnWidths.js +57 -0
  17. package/dist/lib/common/cmToPt.d.ts +2 -0
  18. package/dist/lib/common/cmToPt.d.ts.map +1 -0
  19. package/dist/lib/common/cmToPt.js +35 -0
  20. package/dist/lib/common/extractTableRows.d.ts +3 -0
  21. package/dist/lib/common/extractTableRows.d.ts.map +1 -0
  22. package/dist/lib/common/extractTableRows.js +43 -0
  23. package/dist/lib/common/getFontName.d.ts +2 -0
  24. package/dist/lib/common/getFontName.d.ts.map +1 -0
  25. package/dist/lib/common/getFontName.js +33 -0
  26. package/dist/lib/common/getMargin.d.ts +8 -0
  27. package/dist/lib/common/getMargin.d.ts.map +1 -0
  28. package/dist/lib/common/getMargin.js +30 -0
  29. package/dist/lib/common/getPadding.d.ts +8 -0
  30. package/dist/lib/common/getPadding.d.ts.map +1 -0
  31. package/dist/lib/common/getPadding.js +31 -0
  32. package/dist/lib/common/getSvgSize.d.ts +5 -0
  33. package/dist/lib/common/getSvgSize.d.ts.map +1 -0
  34. package/dist/lib/common/getSvgSize.js +40 -0
  35. package/dist/lib/common/mergeProps.d.ts +3 -0
  36. package/dist/lib/common/mergeProps.d.ts.map +1 -0
  37. package/dist/lib/common/mergeProps.js +27 -0
  38. package/dist/lib/common/normalize.d.ts +3 -0
  39. package/dist/lib/common/normalize.d.ts.map +1 -0
  40. package/dist/lib/common/normalize.js +67 -0
  41. package/dist/lib/common/parseInlineMarkdown.d.ts +3 -0
  42. package/dist/lib/common/parseInlineMarkdown.d.ts.map +1 -0
  43. package/dist/lib/common/parseInlineMarkdown.js +65 -0
  44. package/dist/lib/common/prepareText.d.ts +3 -0
  45. package/dist/lib/common/prepareText.d.ts.map +1 -0
  46. package/dist/lib/common/prepareText.js +38 -0
  47. package/dist/lib/common/resolveSize.d.ts +2 -0
  48. package/dist/lib/common/resolveSize.d.ts.map +1 -0
  49. package/dist/lib/common/resolveSize.js +42 -0
  50. package/dist/lib/common/truncateWithEllipsis.d.ts +2 -0
  51. package/dist/lib/common/truncateWithEllipsis.d.ts.map +1 -0
  52. package/dist/lib/common/truncateWithEllipsis.js +42 -0
  53. package/dist/lib/constants.d.ts +2 -0
  54. package/dist/lib/constants.d.ts.map +1 -0
  55. package/dist/lib/constants.js +22 -0
  56. package/dist/lib/measure/measureFlex.d.ts +3 -0
  57. package/dist/lib/measure/measureFlex.d.ts.map +1 -0
  58. package/dist/lib/measure/measureFlex.js +91 -0
  59. package/dist/lib/measure/measureImage.d.ts +3 -0
  60. package/dist/lib/measure/measureImage.d.ts.map +1 -0
  61. package/dist/lib/measure/measureImage.js +37 -0
  62. package/dist/lib/measure/measureNode.d.ts +3 -0
  63. package/dist/lib/measure/measureNode.d.ts.map +1 -0
  64. package/dist/lib/measure/measureNode.js +54 -0
  65. package/dist/lib/measure/measureTable.d.ts +3 -0
  66. package/dist/lib/measure/measureTable.d.ts.map +1 -0
  67. package/dist/lib/measure/measureTable.js +46 -0
  68. package/dist/lib/measure/measureTableCell.d.ts +3 -0
  69. package/dist/lib/measure/measureTableCell.d.ts.map +1 -0
  70. package/dist/lib/measure/measureTableCell.js +57 -0
  71. package/dist/lib/measure/measureText.d.ts +3 -0
  72. package/dist/lib/measure/measureText.d.ts.map +1 -0
  73. package/dist/lib/measure/measureText.js +62 -0
  74. package/dist/lib/pdf.d.ts +3 -0
  75. package/dist/lib/pdf.d.ts.map +1 -0
  76. package/dist/lib/pdf.js +106 -0
  77. package/dist/lib/render/measureSvg.d.ts +3 -0
  78. package/dist/lib/render/measureSvg.d.ts.map +1 -0
  79. package/dist/lib/render/measureSvg.js +30 -0
  80. package/dist/lib/render/renderBarCode.d.ts +3 -0
  81. package/dist/lib/render/renderBarCode.d.ts.map +1 -0
  82. package/dist/lib/render/renderBarCode.js +53 -0
  83. package/dist/lib/render/renderFlex.d.ts +3 -0
  84. package/dist/lib/render/renderFlex.d.ts.map +1 -0
  85. package/dist/lib/render/renderFlex.js +148 -0
  86. package/dist/lib/render/renderImage.d.ts +3 -0
  87. package/dist/lib/render/renderImage.d.ts.map +1 -0
  88. package/dist/lib/render/renderImage.js +41 -0
  89. package/dist/lib/render/renderNode.d.ts +3 -0
  90. package/dist/lib/render/renderNode.d.ts.map +1 -0
  91. package/dist/lib/render/renderNode.js +53 -0
  92. package/dist/lib/render/renderPage.d.ts +3 -0
  93. package/dist/lib/render/renderPage.d.ts.map +1 -0
  94. package/dist/lib/render/renderPage.js +36 -0
  95. package/dist/lib/render/renderQrCode.d.ts +3 -0
  96. package/dist/lib/render/renderQrCode.d.ts.map +1 -0
  97. package/dist/lib/render/renderQrCode.js +45 -0
  98. package/dist/lib/render/renderSvg.d.ts +3 -0
  99. package/dist/lib/render/renderSvg.d.ts.map +1 -0
  100. package/dist/lib/render/renderSvg.js +74 -0
  101. package/dist/lib/render/renderTable.d.ts +3 -0
  102. package/dist/lib/render/renderTable.d.ts.map +1 -0
  103. package/dist/lib/render/renderTable.js +159 -0
  104. package/dist/lib/render/renderTableCell.d.ts +3 -0
  105. package/dist/lib/render/renderTableCell.d.ts.map +1 -0
  106. package/dist/lib/render/renderTableCell.js +70 -0
  107. package/dist/lib/render/renderText.d.ts +3 -0
  108. package/dist/lib/render/renderText.d.ts.map +1 -0
  109. package/dist/lib/render/renderText.js +102 -0
  110. package/dist/lib/types/BaseProps.d.ts +51 -0
  111. package/dist/lib/types/BaseProps.d.ts.map +1 -0
  112. package/dist/lib/types/BaseProps.js +20 -0
  113. package/dist/lib/types/FlexAlign.d.ts +2 -0
  114. package/dist/lib/types/FlexAlign.d.ts.map +1 -0
  115. package/dist/lib/types/FlexAlign.js +20 -0
  116. package/dist/lib/types/HorizontalTextAlignment.d.ts +2 -0
  117. package/dist/lib/types/HorizontalTextAlignment.d.ts.map +1 -0
  118. package/dist/lib/types/HorizontalTextAlignment.js +20 -0
  119. package/dist/lib/types/LayoutBox.d.ts +7 -0
  120. package/dist/lib/types/LayoutBox.d.ts.map +1 -0
  121. package/dist/lib/types/LayoutBox.js +20 -0
  122. package/dist/lib/types/LineBreakMode.d.ts +2 -0
  123. package/dist/lib/types/LineBreakMode.d.ts.map +1 -0
  124. package/dist/lib/types/LineBreakMode.js +20 -0
  125. package/dist/lib/types/MarginOptions.d.ts +7 -0
  126. package/dist/lib/types/MarginOptions.d.ts.map +1 -0
  127. package/dist/lib/types/MarginOptions.js +20 -0
  128. package/dist/lib/types/NodeElement.d.ts +7 -0
  129. package/dist/lib/types/NodeElement.d.ts.map +1 -0
  130. package/dist/lib/types/NodeElement.js +20 -0
  131. package/dist/lib/types/PaperFormat.d.ts +12 -0
  132. package/dist/lib/types/PaperFormat.d.ts.map +1 -0
  133. package/dist/lib/types/PaperFormat.js +33 -0
  134. package/dist/lib/types/PdfOptions.d.ts +10 -0
  135. package/dist/lib/types/PdfOptions.d.ts.map +1 -0
  136. package/dist/lib/types/PdfOptions.js +20 -0
  137. package/dist/lib/types/TextSegment.d.ts +7 -0
  138. package/dist/lib/types/TextSegment.d.ts.map +1 -0
  139. package/dist/lib/types/TextSegment.js +20 -0
  140. package/dist/lib/types/TextTransform.d.ts +2 -0
  141. package/dist/lib/types/TextTransform.d.ts.map +1 -0
  142. package/dist/lib/types/TextTransform.js +20 -0
  143. package/dist/lib/types/TextType.d.ts +2 -0
  144. package/dist/lib/types/TextType.d.ts.map +1 -0
  145. package/dist/lib/types/TextType.js +20 -0
  146. package/dist/lib/types/VerticalTextAlignment.d.ts +2 -0
  147. package/dist/lib/types/VerticalTextAlignment.d.ts.map +1 -0
  148. package/dist/lib/types/VerticalTextAlignment.js +20 -0
  149. package/dist/lib/types/index.d.ts +14 -0
  150. package/dist/lib/types/index.d.ts.map +1 -0
  151. package/dist/lib/types/index.js +23 -0
  152. package/dist/program.d.ts +5 -0
  153. package/dist/program.d.ts.map +1 -0
  154. package/dist/program.js +116 -0
  155. package/package.json +76 -0
  156. package/singleton/Courier-Bold.afm +342 -0
  157. package/singleton/Courier-BoldOblique.afm +342 -0
  158. package/singleton/Courier-Oblique.afm +342 -0
  159. package/singleton/Courier.afm +342 -0
  160. package/singleton/Helvetica-Bold.afm +2827 -0
  161. package/singleton/Helvetica-BoldOblique.afm +2827 -0
  162. package/singleton/Helvetica-Oblique.afm +3051 -0
  163. package/singleton/Helvetica.afm +3051 -0
  164. package/singleton/Symbol.afm +213 -0
  165. package/singleton/Times-Bold.afm +2588 -0
  166. package/singleton/Times-BoldItalic.afm +2384 -0
  167. package/singleton/Times-Italic.afm +2667 -0
  168. package/singleton/Times-Roman.afm +2419 -0
  169. package/singleton/ZapfDingbats.afm +225 -0
  170. package/singleton/index.js +101612 -0
  171. package/singleton/sRGB_IEC61966_2_1.icc +0 -0
  172. package/tsconfig.json +12 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ All notable changes to **PDFXml** will be documented in this file.
4
+
5
+ The format is based on *Keep a Changelog*, and this project aims to follow semantic versioning.
6
+
7
+ ---
8
+
9
+ ## [0.1.0] - 2026-06-28
10
+
11
+ ### Added
12
+
13
+ *
14
+
15
+ ### Notes
16
+
17
+ *
@@ -0,0 +1,152 @@
1
+ # Contributing to PDFXml
2
+
3
+ First of all, thank you for considering contributing to PDFXml 🎉
4
+
5
+ This project is open source, and contributions of all kinds are welcome — whether it's fixing bugs, improving documentation, suggesting features, or submitting new code.
6
+
7
+ ---
8
+
9
+ ## Code of Conduct
10
+
11
+ By participating in this project, you agree to maintain a respectful and constructive environment for everyone.
12
+
13
+ Be kind, be respectful, and focus on helping improve the project.
14
+
15
+ ---
16
+
17
+ ## How you can contribute
18
+
19
+ You can contribute in several ways:
20
+
21
+ * Reporting bugs
22
+ * Suggesting new features
23
+ * Improving documentation
24
+ * Submitting pull requests
25
+ * Sharing feedback from real usage
26
+
27
+ ---
28
+
29
+ ## Getting Started
30
+
31
+ ### 1. Fork the repository
32
+
33
+ Click the "Fork" button on GitHub and clone your fork locally:
34
+
35
+ ```bash id="k3j9pm"
36
+ git clone https://github.com/josedinizdev/PDFXml.git
37
+ cd PDFXml
38
+ ```
39
+
40
+ ---
41
+
42
+ ### 2. Install dependencies
43
+
44
+ ```bash id="q8n3xw"
45
+ npm install
46
+ ```
47
+
48
+ ---
49
+
50
+ ### 3. Run the project in development mode
51
+
52
+ ```bash id="x1m7zq"
53
+ npm run dev
54
+ ```
55
+
56
+ ---
57
+
58
+ ### 4. Build the project
59
+
60
+ ```bash id="p9c2va"
61
+ npm run build
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Project structure
67
+
68
+ ```
69
+ lib/
70
+ common/
71
+ measure/
72
+ render/
73
+ types/
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Making changes
79
+
80
+ Before submitting a pull request:
81
+
82
+ * Make sure your code follows the project structure
83
+ * Keep changes focused and minimal
84
+ * Test your changes manually
85
+ * Ensure the CLI still works as expected
86
+
87
+ ---
88
+
89
+ ## Submitting a Pull Request
90
+
91
+ 1. Create a new branch:
92
+
93
+ ```bash id="b7k2lm"
94
+ git checkout -b feature/my-feature
95
+ ```
96
+
97
+ 2. Commit your changes:
98
+
99
+ ```bash id="d4q9xz"
100
+ git commit -m "Add: my feature description"
101
+ ```
102
+
103
+ 3. Push your branch:
104
+
105
+ ```bash id="m2v8cn"
106
+ git push origin feature/my-feature
107
+ ```
108
+
109
+ 4. Open a Pull Request on GitHub
110
+
111
+ ---
112
+
113
+ ## Reporting Issues
114
+
115
+ If you find a bug or unexpected behavior, please open an issue including:
116
+
117
+ * Steps to reproduce
118
+ * Expected behavior
119
+ * Actual behavior
120
+ * Example XML (if applicable)
121
+ * Environment details (Node version, OS, etc.)
122
+
123
+ ---
124
+
125
+ ## Feature Requests
126
+
127
+ Feature suggestions are welcome.
128
+
129
+ Please describe:
130
+
131
+ * The problem you're trying to solve
132
+ * A possible solution or example
133
+ * Why it would be useful
134
+
135
+ ---
136
+
137
+ ## Development Notes
138
+
139
+ PDFXml is designed to be:
140
+
141
+ * Simple to extend
142
+ * Predictable in output
143
+ * Independent of browser environments
144
+ * Focused on performance and clarity
145
+
146
+ ---
147
+
148
+ ## Thank you
149
+
150
+ Your contributions help make PDFXml better for everyone.
151
+
152
+ I really appreciate your time and effort in improving this project 🚀
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 josedinizdev
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # PDFXml
2
+ [Português (Brasil)](README_pt-br.md)
3
+
4
+ > Generate high-quality PDF documents using XML.
5
+
6
+ PDFXml is an open-source library for generating PDF documents from XML templates. It was created to make PDF generation more organized, maintainable and scalable, without sacrificing performance or flexibility.
7
+
8
+ Whether you are building reports, invoices, labels, receipts, fiscal documents or any other printable document, PDFXml provides a simple and declarative way to describe your layouts.
9
+
10
+ ## Why PDFXml?
11
+
12
+ PDFXml was born while I was developing PDF reports for real-world applications.
13
+
14
+ During that process, I found myself facing the same challenges repeatedly. Many available solutions required commercial licenses, while others were excellent for simple documents but became difficult to maintain as layouts grew in complexity.
15
+
16
+ My goal was to build a tool that allowed complex documents to remain simple to develop, easy to maintain and pleasant to evolve over time.
17
+
18
+ Instead of creating PDFs entirely through imperative code, PDFXml introduces a declarative XML language that keeps document structure organized and readable.
19
+
20
+ Today, PDFXml is used in production projects and has proven to be reliable for generating different kinds of documents. I'm excited to see what other developers and companies will build with it.
21
+
22
+ ## Why XML?
23
+
24
+ XML was chosen intentionally.
25
+
26
+ It is a mature, well-known and highly structured markup language that is easy to read, generate and validate.
27
+
28
+ For developers already working with backend systems, APIs or integrations, XML usually has a very small learning curve while providing an expressive way to describe complex document layouts.
29
+
30
+ ## Features
31
+
32
+ * Declarative XML syntax
33
+ * High-quality PDF generation
34
+ * Report generation
35
+ * Invoice support
36
+ * Receipt generation
37
+ * Label generation
38
+ * SVG rendering
39
+ * QR Code support
40
+ * Barcode support
41
+ * Custom page sizes
42
+ * Margin configuration
43
+ * Custom fonts
44
+ * Multi-page documents
45
+ * TypeScript support
46
+ * CLI support
47
+ * Open Source
48
+ * Apache 2.0 License
49
+
50
+ ## Who is PDFXml for?
51
+
52
+ PDFXml is suitable for anyone who needs to generate PDF documents dynamically, including:
53
+
54
+ * SaaS applications
55
+ * ERP systems
56
+ * Automation platforms
57
+ * Financial systems
58
+ * Fiscal systems
59
+ * Reporting tools
60
+ * Developers
61
+ * Students
62
+ * Programming enthusiasts
63
+
64
+ If you understand XML, you'll feel at home.
65
+
66
+ ## Installation
67
+
68
+ ```bash
69
+ npm install pdfxml
70
+ ```
71
+
72
+ or
73
+
74
+ ```bash
75
+ pnpm add pdfxml
76
+ ```
77
+
78
+ or
79
+
80
+ ```bash
81
+ yarn add pdfxml
82
+ ```
83
+
84
+ ## Quick Example
85
+
86
+ ```xml
87
+ <Column>
88
+ <Text FontSize="14">Hello World</Text>
89
+ <Row Gap="10">
90
+ <Text>Left</Text>
91
+ <Text>Right</Text>
92
+ </Row>
93
+ </Column>
94
+ ```
95
+
96
+ ```bash
97
+ pdfxml --xml=document.xml --output=document.pdf --format=A4
98
+ ```
99
+
100
+ More complete examples are available in the documentation.
101
+
102
+ ## Documentation
103
+
104
+ The complete documentation includes:
105
+
106
+ * XML language reference
107
+ * Supported elements
108
+ * Styling
109
+ * Images
110
+ * Tables
111
+ * QR Codes
112
+ * Barcodes
113
+ * SVG
114
+ * Fonts
115
+ * CLI
116
+ * Examples
117
+
118
+ Documentation is available on the project website.
119
+
120
+ ## Contributing
121
+
122
+ Contributions are always welcome.
123
+
124
+ Whether you found a bug, have an idea for a new feature or simply want to improve the documentation, feel free to open an issue or submit a pull request.
125
+
126
+ ## A personal note
127
+
128
+ PDFXml started as a solution to my own problem.
129
+
130
+ After using it successfully, I decided to make it open source because I believe more developers should have access to a modern, practical and free tool for PDF generation.
131
+
132
+ I genuinely hope this project helps you build something amazing, and I'm looking forward to seeing what the community creates with it.
133
+
134
+ ## License
135
+
136
+ PDFXml is licensed under the Apache License 2.0.
137
+
138
+ You are free to use it in personal, academic and commercial projects while respecting the terms of the license.
139
+
140
+ See the [LICENSE](LICENSE) file.
@@ -0,0 +1,4 @@
1
+ import { pdf } from './lib/pdf';
2
+ declare const PDFXml: typeof pdf;
3
+ export default PDFXml;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAC7B,QAAA,MAAM,MAAM,YAAM,CAAC;AAEnB,eAAe,MAAM,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2026 josedinizdev
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ *
15
+ * Author: José Diogo Caetano Diniz
16
+ * GitHub: https://github.com/josedinizdev
17
+ * Project: https://github.com/josedinizdev/PDFXml
18
+ *
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const pdf_1 = require("./lib/pdf");
22
+ const PDFXml = pdf_1.pdf;
23
+ exports.default = PDFXml;
@@ -0,0 +1,3 @@
1
+ import { LayoutBox, NodeElement } from "../types";
2
+ export declare function applyBoxStyle(doc: PDFKit.PDFDocument, node: NodeElement, box: LayoutBox): void;
3
+ //# sourceMappingURL=applyBoxStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyBoxStyle.d.ts","sourceRoot":"","sources":["../../../lib/common/applyBoxStyle.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEjD,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,CAAC,WAAW,EACvB,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,SAAS,QAgCf"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2026 josedinizdev
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ *
15
+ * Author: José Diogo Caetano Diniz
16
+ * GitHub: https://github.com/josedinizdev
17
+ * Project: https://github.com/josedinizdev/PDFXml
18
+ *
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.applyBoxStyle = applyBoxStyle;
22
+ function applyBoxStyle(doc, node, box) {
23
+ doc.save();
24
+ if (node.props.BackgroundColor) {
25
+ doc
26
+ .fillColor(node.props.BackgroundColor)
27
+ .roundedRect(box.x, box.y, box.width, box.height, node.props.BorderRadius || 0)
28
+ .fill();
29
+ }
30
+ if (node.props.BorderColor) {
31
+ doc
32
+ .lineWidth(node.props.BorderWidth || 1)
33
+ .strokeColor(node.props.BorderColor)
34
+ .roundedRect(box.x, box.y, box.width, box.height, node.props.BorderRadius || 0)
35
+ .stroke();
36
+ }
37
+ doc.restore();
38
+ }
@@ -0,0 +1,3 @@
1
+ import { NodeElement } from "../types";
2
+ export declare function applyTextStyle(doc: PDFKit.PDFDocument, node: NodeElement): void;
3
+ //# sourceMappingURL=applyTextStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyTextStyle.d.ts","sourceRoot":"","sources":["../../../lib/common/applyTextStyle.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,CAAC,WAAW,EACvB,IAAI,EAAE,WAAW,QAiClB"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2026 josedinizdev
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ *
15
+ * Author: José Diogo Caetano Diniz
16
+ * GitHub: https://github.com/josedinizdev
17
+ * Project: https://github.com/josedinizdev/PDFXml
18
+ *
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.applyTextStyle = applyTextStyle;
22
+ function applyTextStyle(doc, node) {
23
+ const fontSize = node.props.FontSize ||
24
+ (() => {
25
+ switch (node.props.TextType) {
26
+ case 'title':
27
+ return 24;
28
+ case 'subtitle':
29
+ return 18;
30
+ case 'caption':
31
+ return 10;
32
+ default:
33
+ return 14;
34
+ }
35
+ })();
36
+ doc.font('Helvetica');
37
+ doc.fontSize(14);
38
+ doc.fillColor('black');
39
+ if (node.props.FontFamily) {
40
+ doc.font(node.props.FontFamily);
41
+ }
42
+ doc.fontSize(fontSize);
43
+ if (node.props.TextColor) {
44
+ doc.fillColor(node.props.TextColor);
45
+ }
46
+ }
@@ -0,0 +1,3 @@
1
+ import { NodeElement } from "../types";
2
+ export declare function calculateTableColumnWidths(doc: PDFKit.PDFDocument, rows: NodeElement[], tableWidth: number): number[];
3
+ //# sourceMappingURL=calculateTableColumnWidths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateTableColumnWidths.d.ts","sourceRoot":"","sources":["../../../lib/common/calculateTableColumnWidths.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,CAAC,WAAW,EACvB,IAAI,EAAE,WAAW,EAAE,EACnB,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAkEV"}