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
@@ -0,0 +1,57 @@
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.calculateTableColumnWidths = calculateTableColumnWidths;
22
+ function calculateTableColumnWidths(doc, rows, tableWidth) {
23
+ const columnCount = Math.max(...rows.map((r) => r.children.filter((c) => typeof c !== 'string').length));
24
+ const widths = new Array(columnCount).fill(0);
25
+ const fills = new Array(columnCount).fill(1);
26
+ // Primeiro pass:
27
+ // pega Width fixa e Fill
28
+ for (const row of rows) {
29
+ const cells = row.children.filter((c) => typeof c !== 'string');
30
+ cells.forEach((cell, index) => {
31
+ if (cell.props.Width) {
32
+ widths[index] = Math.max(widths[index], cell.props.Width);
33
+ }
34
+ fills[index] =
35
+ cell.props.Fill || fills[index];
36
+ });
37
+ }
38
+ const fixedWidth = widths.reduce((a, b) => a + b, 0);
39
+ const flexibleColumns = widths.map((w, i) => ({
40
+ index: i,
41
+ fill: fills[i],
42
+ flexible: w === 0,
43
+ }));
44
+ const totalFill = flexibleColumns
45
+ .filter((c) => c.flexible)
46
+ .reduce((acc, c) => acc + c.fill, 0);
47
+ const remainingWidth = tableWidth - fixedWidth;
48
+ for (const column of flexibleColumns) {
49
+ if (!column.flexible) {
50
+ continue;
51
+ }
52
+ widths[column.index] =
53
+ remainingWidth *
54
+ (column.fill / totalFill);
55
+ }
56
+ return widths;
57
+ }
@@ -0,0 +1,2 @@
1
+ export declare function cmToPt(value: string | number): number;
2
+ //# sourceMappingURL=cmToPt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmToPt.d.ts","sourceRoot":"","sources":["../../../lib/common/cmToPt.ts"],"names":[],"mappings":"AAmBA,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAiBrD"}
@@ -0,0 +1,35 @@
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.cmToPt = cmToPt;
22
+ function cmToPt(value) {
23
+ if (typeof value == 'number')
24
+ return value;
25
+ if (value.endsWith('cm')) {
26
+ return parseFloat(value) * 28.3465;
27
+ }
28
+ if (value.endsWith('mm')) {
29
+ return parseFloat(value) * 72 / 25.4;
30
+ }
31
+ if (value.endsWith('in')) {
32
+ return parseFloat(value) * 72;
33
+ }
34
+ return Number(value);
35
+ }
@@ -0,0 +1,3 @@
1
+ import { NodeElement } from "../types";
2
+ export declare function extractTableRows(node: NodeElement): NodeElement[];
3
+ //# sourceMappingURL=extractTableRows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractTableRows.d.ts","sourceRoot":"","sources":["../../../lib/common/extractTableRows.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,GAChB,WAAW,EAAE,CA+Bf"}
@@ -0,0 +1,43 @@
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.extractTableRows = extractTableRows;
22
+ function extractTableRows(node) {
23
+ const rows = [];
24
+ for (const child of node.children) {
25
+ if (typeof child === 'string') {
26
+ continue;
27
+ }
28
+ if (child.type === 'TRow') {
29
+ rows.push(child);
30
+ }
31
+ if (child.type === 'THead' ||
32
+ child.type === 'TBody' ||
33
+ child.type === 'TFoot') {
34
+ for (const nested of child.children) {
35
+ if (typeof nested !== 'string' &&
36
+ nested.type === 'TRow') {
37
+ rows.push(nested);
38
+ }
39
+ }
40
+ }
41
+ }
42
+ return rows;
43
+ }
@@ -0,0 +1,2 @@
1
+ export declare function getFontName(baseFont: string, bold?: boolean, italic?: boolean): string;
2
+ //# sourceMappingURL=getFontName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFontName.d.ts","sourceRoot":"","sources":["../../../lib/common/getFontName.ts"],"names":[],"mappings":"AAmBA,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,OAAO,UAejB"}
@@ -0,0 +1,33 @@
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.getFontName = getFontName;
22
+ function getFontName(baseFont, bold, italic) {
23
+ if (bold && italic) {
24
+ return `${baseFont}-BoldOblique`;
25
+ }
26
+ if (bold) {
27
+ return `${baseFont}-Bold`;
28
+ }
29
+ if (italic) {
30
+ return `${baseFont}-Oblique`;
31
+ }
32
+ return baseFont;
33
+ }
@@ -0,0 +1,8 @@
1
+ import { BaseProps } from "../types";
2
+ export declare function getMargin(props: BaseProps): {
3
+ top: number;
4
+ right: number;
5
+ bottom: number;
6
+ left: number;
7
+ };
8
+ //# sourceMappingURL=getMargin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMargin.d.ts","sourceRoot":"","sources":["../../../lib/common/getMargin.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,wBAAgB,SAAS,CACvB,KAAK,EAAE,SAAS;;;;;EAejB"}
@@ -0,0 +1,30 @@
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.getMargin = getMargin;
22
+ const cmToPt_1 = require("./cmToPt");
23
+ function getMargin(props) {
24
+ return {
25
+ top: (0, cmToPt_1.cmToPt)(props.MarginTop ?? 0),
26
+ right: (0, cmToPt_1.cmToPt)(props.MarginRight ?? 0),
27
+ bottom: (0, cmToPt_1.cmToPt)(props.MarginBottom ?? 0),
28
+ left: (0, cmToPt_1.cmToPt)(props.MarginLeft ?? 0),
29
+ };
30
+ }
@@ -0,0 +1,8 @@
1
+ import { BaseProps } from "../types";
2
+ export declare function getPadding(props: BaseProps): {
3
+ top: number;
4
+ right: number;
5
+ bottom: number;
6
+ left: number;
7
+ };
8
+ //# sourceMappingURL=getPadding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPadding.d.ts","sourceRoot":"","sources":["../../../lib/common/getPadding.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS;;;;;EAiBjB"}
@@ -0,0 +1,31 @@
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.getPadding = getPadding;
22
+ const cmToPt_1 = require("./cmToPt");
23
+ function getPadding(props) {
24
+ const padding = props.Padding || 0;
25
+ return {
26
+ top: (0, cmToPt_1.cmToPt)(props.PaddingTop ?? padding),
27
+ right: (0, cmToPt_1.cmToPt)(props.PaddingRight ?? padding),
28
+ bottom: (0, cmToPt_1.cmToPt)(props.PaddingBottom ?? padding),
29
+ left: (0, cmToPt_1.cmToPt)(props.PaddingLeft ?? padding),
30
+ };
31
+ }
@@ -0,0 +1,5 @@
1
+ export declare function getSvgSize(svg: string): {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ //# sourceMappingURL=getSvgSize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSvgSize.d.ts","sourceRoot":"","sources":["../../../lib/common/getSvgSize.ts"],"names":[],"mappings":"AAmBA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM;;;EA6BrC"}
@@ -0,0 +1,40 @@
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.getSvgSize = getSvgSize;
22
+ function getSvgSize(svg) {
23
+ const match = svg.match(/viewBox="([\d.-]+)\s+([\d.-]+)\s+([\d.-]+)\s+([\d.-]+)"/i);
24
+ if (match) {
25
+ return {
26
+ width: Number(match[3]),
27
+ height: Number(match[4]),
28
+ };
29
+ }
30
+ const widthMatch = svg.match(/width="([\d.]+)"/i);
31
+ const heightMatch = svg.match(/height="([\d.]+)"/i);
32
+ return {
33
+ width: widthMatch
34
+ ? Number(widthMatch[1])
35
+ : 100,
36
+ height: heightMatch
37
+ ? Number(heightMatch[1])
38
+ : 100,
39
+ };
40
+ }
@@ -0,0 +1,3 @@
1
+ import { BaseProps } from "../types";
2
+ export declare function mergeProps(parent: BaseProps, current: BaseProps): BaseProps;
3
+ //# sourceMappingURL=mergeProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeProps.d.ts","sourceRoot":"","sources":["../../../lib/common/mergeProps.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,SAAS,GACjB,SAAS,CAKX"}
@@ -0,0 +1,27 @@
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.mergeProps = mergeProps;
22
+ function mergeProps(parent, current) {
23
+ return {
24
+ ...parent,
25
+ ...current,
26
+ };
27
+ }
@@ -0,0 +1,3 @@
1
+ import { BaseProps, NodeElement } from "../types";
2
+ export declare function normalize(nodes: any[], inheritedProps?: Partial<BaseProps>): NodeElement;
3
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../lib/common/normalize.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEjD,wBAAgB,SAAS,CACvB,KAAK,EAAE,GAAG,EAAE,EACZ,cAAc,GAAE,OAAO,CAAC,SAAS,CAAM,GACtC,WAAW,CA2Eb"}
@@ -0,0 +1,67 @@
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.normalize = normalize;
22
+ function normalize(nodes, inheritedProps = {}) {
23
+ const node = nodes[0];
24
+ const type = Object.keys(node).find((k) => k !== ':@');
25
+ const raw = node[type];
26
+ const props = {
27
+ FontFamily: inheritedProps.FontFamily,
28
+ FontSize: inheritedProps.FontSize,
29
+ AutoPageBreak: inheritedProps.AutoPageBreak,
30
+ LineHeight: inheritedProps.LineHeight,
31
+ };
32
+ if (node[':@']) {
33
+ for (const [key, value] of Object.entries(node[':@'])) {
34
+ ;
35
+ props[key] =
36
+ value === 'true'
37
+ ? true
38
+ : value === 'false'
39
+ ? false
40
+ : isNaN(Number(value))
41
+ ? value
42
+ : Number(value);
43
+ }
44
+ }
45
+ const nextInheritedProps = {
46
+ FontFamily: props.FontFamily,
47
+ AutoPageBreak: props.AutoPageBreak,
48
+ FontSize: props.FontSize,
49
+ };
50
+ const children = [];
51
+ for (const item of raw || []) {
52
+ const key = Object.keys(item)[0];
53
+ if (key === '#text') {
54
+ const value = String(item['#text'] ?? '').trim();
55
+ if (value) {
56
+ children.push(value);
57
+ }
58
+ continue;
59
+ }
60
+ children.push(normalize([item], nextInheritedProps));
61
+ }
62
+ return {
63
+ type,
64
+ props,
65
+ children,
66
+ };
67
+ }
@@ -0,0 +1,3 @@
1
+ import { TextSegment } from "../types";
2
+ export declare function parseInlineMarkdown(text: string): TextSegment[];
3
+ //# sourceMappingURL=parseInlineMarkdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseInlineMarkdown.d.ts","sourceRoot":"","sources":["../../../lib/common/parseInlineMarkdown.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GACX,WAAW,EAAE,CA4Df"}
@@ -0,0 +1,65 @@
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.parseInlineMarkdown = parseInlineMarkdown;
22
+ function parseInlineMarkdown(text) {
23
+ const segments = [];
24
+ const regex = /(\*\*\*.*?\*\*\*|\*\*.*?\*\*|\*.*?\*)/g;
25
+ let lastIndex = 0;
26
+ for (const match of text.matchAll(regex)) {
27
+ const index = match.index || 0;
28
+ if (index > lastIndex) {
29
+ segments.push({
30
+ text: text.slice(lastIndex, index),
31
+ });
32
+ }
33
+ const token = match[0];
34
+ if (token.startsWith('***') &&
35
+ token.endsWith('***')) {
36
+ segments.push({
37
+ text: token.slice(3, -3),
38
+ bold: true,
39
+ italic: true,
40
+ });
41
+ }
42
+ else if (token.startsWith('**') &&
43
+ token.endsWith('**')) {
44
+ segments.push({
45
+ text: token.slice(2, -2),
46
+ bold: true,
47
+ });
48
+ }
49
+ else if (token.startsWith('*') &&
50
+ token.endsWith('*')) {
51
+ segments.push({
52
+ text: token.slice(1, -1),
53
+ italic: true,
54
+ });
55
+ }
56
+ lastIndex =
57
+ index + token.length;
58
+ }
59
+ if (lastIndex < text.length) {
60
+ segments.push({
61
+ text: text.slice(lastIndex),
62
+ });
63
+ }
64
+ return segments;
65
+ }
@@ -0,0 +1,3 @@
1
+ import { NodeElement } from "../types";
2
+ export declare function prepareText(node: NodeElement): string;
3
+ //# sourceMappingURL=prepareText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareText.d.ts","sourceRoot":"","sources":["../../../lib/common/prepareText.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC,wBAAgB,WAAW,CACzB,IAAI,EAAE,WAAW,GAChB,MAAM,CAsBR"}
@@ -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.prepareText = prepareText;
22
+ function prepareText(node) {
23
+ let text = node.children
24
+ .filter((c) => typeof c === 'string')
25
+ .join(' ');
26
+ switch (node.props.TextTransform) {
27
+ case 'uppercase':
28
+ text = text.toUpperCase();
29
+ break;
30
+ case 'lowercase':
31
+ text = text.toLowerCase();
32
+ break;
33
+ case 'capitalize':
34
+ text = text.replace(/\b\w/g, (l) => l.toUpperCase());
35
+ break;
36
+ }
37
+ return text;
38
+ }
@@ -0,0 +1,2 @@
1
+ export declare function resolveSize(value: number | string | undefined, parentSize: number): number | undefined;
2
+ //# sourceMappingURL=resolveSize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveSize.d.ts","sourceRoot":"","sources":["../../../lib/common/resolveSize.ts"],"names":[],"mappings":"AAqBA,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAClC,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,SAAS,CAwBpB"}
@@ -0,0 +1,42 @@
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.resolveSize = resolveSize;
22
+ const cmToPt_1 = require("./cmToPt");
23
+ function resolveSize(value, parentSize) {
24
+ if (value == null) {
25
+ return undefined;
26
+ }
27
+ if (typeof value === 'number') {
28
+ return value;
29
+ }
30
+ if (typeof value === 'string') {
31
+ const trimmed = value.trim();
32
+ if (trimmed.endsWith('%')) {
33
+ return (parentSize *
34
+ parseFloat(trimmed) /
35
+ 100);
36
+ }
37
+ else {
38
+ return (0, cmToPt_1.cmToPt)(trimmed);
39
+ }
40
+ }
41
+ return undefined;
42
+ }
@@ -0,0 +1,2 @@
1
+ export declare function truncateWithEllipsis(doc: PDFKit.PDFDocument, text: string, maxWidth: number, characterSpacing?: number): string;
2
+ //# sourceMappingURL=truncateWithEllipsis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truncateWithEllipsis.d.ts","sourceRoot":"","sources":["../../../lib/common/truncateWithEllipsis.ts"],"names":[],"mappings":"AAmBA,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,CAAC,WAAW,EACvB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,gBAAgB,SAAI,GACnB,MAAM,CA8BR"}