@cj-tech-master/excelts 9.5.4 → 9.5.5
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.
- package/dist/browser/modules/archive/compression/streaming-compress.browser.js +29 -0
- package/dist/browser/modules/archive/compression/streaming-compress.js +9 -0
- package/dist/browser/modules/archive/compression/worker-pool/pool.browser.js +26 -1
- package/dist/browser/modules/archive/fs/archive-file.d.ts +8 -5
- package/dist/browser/modules/archive/fs/archive-file.js +78 -16
- package/dist/browser/modules/archive/unzip/stream.browser.js +43 -2
- package/dist/browser/modules/excel/chart/chart-ex-builder.js +7 -2
- package/dist/browser/modules/excel/chart/chart-ex-renderer.js +4 -9
- package/dist/browser/modules/excel/chart/chart-ex-types.d.ts +0 -12
- package/dist/browser/modules/excel/chart/chart.d.ts +1 -5
- package/dist/browser/modules/excel/chart/chart.js +1 -7
- package/dist/browser/modules/excel/chart/types.d.ts +0 -6
- package/dist/browser/modules/excel/stream/workbook-reader.browser.js +25 -1
- package/dist/browser/modules/excel/stream/workbook-reader.js +9 -0
- package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +40 -0
- package/dist/browser/modules/excel/stream/workbook-writer.browser.js +228 -13
- package/dist/browser/modules/excel/utils/string-buf.d.ts +5 -26
- package/dist/browser/modules/excel/utils/string-buf.js +4 -81
- package/dist/browser/modules/excel/workbook.browser.js +135 -25
- package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.js +6 -20
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +19 -9
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +32 -8
- package/dist/browser/modules/excel/xlsx/xlsx.d.ts +10 -2
- package/dist/browser/modules/excel/xlsx/xlsx.js +9 -1
- package/dist/browser/modules/pdf/excel-bridge.d.ts +30 -1
- package/dist/browser/modules/pdf/excel-bridge.js +32 -0
- package/dist/browser/modules/pdf/font/metrics.d.ts +3 -52
- package/dist/browser/modules/pdf/font/metrics.js +3 -237
- package/dist/browser/modules/pdf/index.d.ts +1 -1
- package/dist/browser/modules/pdf/index.js +1 -1
- package/dist/browser/modules/pdf/render-layout-to-pdf.d.ts +66 -0
- package/dist/browser/modules/pdf/render-layout-to-pdf.js +647 -0
- package/dist/browser/modules/pdf/word-bridge.d.ts +80 -12
- package/dist/browser/modules/pdf/word-bridge.js +122 -274
- package/dist/browser/modules/stream/index.base.d.ts +2 -0
- package/dist/browser/modules/stream/index.base.js +2 -1
- package/dist/browser/modules/stream/internal/sink-adapter.d.ts +65 -0
- package/dist/browser/modules/stream/internal/sink-adapter.js +198 -0
- package/dist/browser/modules/stream/pull-stream.d.ts +19 -2
- package/dist/browser/modules/stream/pull-stream.js +51 -5
- package/dist/browser/modules/stream/types.d.ts +13 -1
- package/dist/browser/modules/word/advanced/diff.d.ts +61 -0
- package/dist/browser/modules/word/advanced/diff.js +167 -0
- package/dist/browser/modules/word/advanced/drawing-shapes.d.ts +269 -0
- package/dist/browser/modules/word/advanced/drawing-shapes.js +268 -0
- package/dist/browser/modules/word/advanced/field-engine.d.ts +43 -0
- package/dist/browser/modules/word/advanced/field-engine.js +1225 -0
- package/dist/browser/modules/word/advanced/glossary.d.ts +86 -0
- package/dist/browser/modules/word/advanced/glossary.js +79 -0
- package/dist/browser/modules/word/advanced/math-convert.d.ts +30 -0
- package/dist/browser/modules/word/advanced/math-convert.js +595 -0
- package/dist/browser/modules/word/advanced/ole-objects.d.ts +115 -0
- package/dist/browser/modules/word/advanced/ole-objects.js +271 -0
- package/dist/browser/modules/word/advanced/style-map.d.ts +105 -0
- package/dist/browser/modules/word/advanced/style-map.js +322 -0
- package/dist/browser/modules/word/advanced/validation.d.ts +56 -0
- package/dist/browser/modules/word/advanced/validation.js +1065 -0
- package/dist/browser/modules/word/advanced/vba-project.d.ts +91 -0
- package/dist/browser/modules/word/advanced/vba-project.js +265 -0
- package/dist/browser/modules/word/bridge/excel-bridge.d.ts +127 -0
- package/dist/browser/modules/word/bridge/excel-bridge.js +980 -0
- package/dist/browser/modules/word/builder/document-handle.d.ts +151 -0
- package/dist/browser/modules/word/builder/document-handle.js +664 -0
- package/dist/browser/modules/word/builder/paragraph-builders.d.ts +61 -0
- package/dist/browser/modules/word/builder/paragraph-builders.js +90 -0
- package/dist/browser/modules/word/builder/run-builders.d.ts +374 -0
- package/dist/browser/modules/word/builder/run-builders.js +600 -0
- package/dist/browser/modules/word/builder/table-builders.d.ts +23 -0
- package/dist/browser/modules/word/builder/table-builders.js +45 -0
- package/dist/browser/modules/word/constants.d.ts +39 -1
- package/dist/browser/modules/word/constants.js +109 -1
- package/dist/browser/modules/word/convert/conversion-ir.d.ts +210 -0
- package/dist/browser/modules/word/convert/conversion-ir.js +31 -0
- package/dist/browser/modules/word/convert/docx-to-semantic.d.ts +39 -0
- package/dist/browser/modules/word/convert/docx-to-semantic.js +499 -0
- package/dist/browser/modules/word/convert/flat-opc.d.ts +44 -0
- package/dist/browser/modules/word/convert/flat-opc.js +385 -0
- package/dist/browser/modules/word/convert/html/html-import.d.ts +50 -0
- package/dist/browser/modules/word/convert/html/html-import.js +1907 -0
- package/dist/{types/modules/word → browser/modules/word/convert/html}/html-renderer.d.ts +14 -1
- package/dist/{esm/modules/word → browser/modules/word/convert/html}/html-renderer.js +420 -69
- package/dist/browser/modules/word/convert/html/html.d.ts +15 -0
- package/dist/browser/modules/word/convert/html/html.js +15 -0
- package/dist/browser/modules/word/convert/markdown/markdown-import.d.ts +68 -0
- package/dist/browser/modules/word/convert/markdown/markdown-import.js +1325 -0
- package/dist/browser/modules/word/convert/markdown/markdown-renderer.d.ts +25 -0
- package/dist/browser/modules/word/convert/markdown/markdown-renderer.js +634 -0
- package/dist/browser/modules/word/convert/markdown/markdown.d.ts +15 -0
- package/dist/browser/modules/word/convert/markdown/markdown.js +15 -0
- package/dist/browser/modules/word/convert/odt/odt.d.ts +41 -0
- package/dist/browser/modules/word/convert/odt/odt.js +1932 -0
- package/dist/browser/modules/word/{color-utils.d.ts → core/color-utils.d.ts} +8 -1
- package/dist/browser/modules/word/core/color-utils.js +43 -0
- package/dist/browser/modules/word/core/internal-utils.d.ts +90 -0
- package/dist/browser/modules/word/core/internal-utils.js +209 -0
- package/dist/browser/modules/word/core/mapper.d.ts +44 -0
- package/dist/browser/modules/word/core/mapper.js +427 -0
- package/dist/browser/modules/word/core/opc-paths.d.ts +33 -0
- package/dist/browser/modules/word/core/opc-paths.js +48 -0
- package/dist/browser/modules/word/core/text-utils.d.ts +38 -0
- package/dist/browser/modules/word/core/text-utils.js +202 -0
- package/dist/browser/modules/word/core/walker.d.ts +119 -0
- package/dist/browser/modules/word/core/walker.js +570 -0
- package/dist/browser/modules/word/crypto.d.ts +14 -9
- package/dist/browser/modules/word/crypto.js +13 -7
- package/dist/browser/modules/word/document-io.d.ts +59 -27
- package/dist/browser/modules/word/document-io.js +80 -197
- package/dist/browser/modules/word/errors.d.ts +44 -1
- package/dist/browser/modules/word/errors.js +54 -2
- package/dist/browser/modules/word/excel.d.ts +14 -0
- package/dist/browser/modules/word/excel.js +13 -0
- package/dist/browser/modules/word/font/font-embed.d.ts +112 -0
- package/dist/browser/modules/word/font/font-embed.js +646 -0
- package/dist/{esm/modules/word → browser/modules/word/font}/font-obfuscation.js +4 -9
- package/dist/browser/modules/word/font/hyphenation.d.ts +65 -0
- package/dist/browser/modules/word/font/hyphenation.js +4210 -0
- package/dist/browser/modules/word/font/text-shaping.d.ts +58 -0
- package/dist/browser/modules/word/font/text-shaping.js +635 -0
- package/dist/browser/modules/word/html.d.ts +7 -6
- package/dist/browser/modules/word/html.js +6 -5
- package/dist/browser/modules/word/incremental-edit.d.ts +123 -0
- package/dist/browser/modules/word/incremental-edit.js +361 -0
- package/dist/browser/modules/word/index.base.d.ts +194 -10
- package/dist/browser/modules/word/index.base.js +138 -29
- package/dist/browser/modules/word/layout/layout-constants.d.ts +17 -0
- package/dist/browser/modules/word/layout/layout-constants.js +17 -0
- package/dist/browser/modules/word/layout/layout-full.d.ts +53 -0
- package/dist/browser/modules/word/layout/layout-full.js +1696 -0
- package/dist/browser/modules/word/layout/layout-model.d.ts +344 -0
- package/dist/browser/modules/word/layout/layout-model.js +16 -0
- package/dist/browser/modules/word/layout/layout.d.ts +63 -0
- package/dist/browser/modules/word/layout/layout.js +1167 -0
- package/dist/browser/modules/word/layout/render-page.d.ts +57 -0
- package/dist/browser/modules/word/layout/render-page.js +1238 -0
- package/dist/browser/modules/word/markdown.d.ts +14 -0
- package/dist/browser/modules/word/markdown.js +13 -0
- package/dist/browser/modules/word/patcher.d.ts +62 -0
- package/dist/browser/modules/word/patcher.js +537 -0
- package/dist/browser/modules/word/query/compat.d.ts +25 -0
- package/dist/browser/modules/word/query/compat.js +58 -0
- package/dist/browser/modules/word/query/data-binding.d.ts +22 -0
- package/dist/browser/modules/word/query/data-binding.js +392 -0
- package/dist/browser/modules/word/query/form-fields.d.ts +41 -0
- package/dist/browser/modules/word/query/form-fields.js +268 -0
- package/dist/browser/modules/word/query/format-search.d.ts +99 -0
- package/dist/browser/modules/word/query/format-search.js +329 -0
- package/dist/browser/modules/word/query/mail-merge.d.ts +25 -0
- package/dist/browser/modules/word/query/mail-merge.js +111 -0
- package/dist/browser/modules/word/query/merge.d.ts +50 -0
- package/dist/browser/modules/word/query/merge.js +617 -0
- package/dist/browser/modules/word/query/replace.d.ts +47 -0
- package/dist/browser/modules/word/query/replace.js +301 -0
- package/dist/browser/modules/word/query/revisions.d.ts +67 -0
- package/dist/browser/modules/word/query/revisions.js +879 -0
- package/dist/browser/modules/word/query/search.d.ts +129 -0
- package/dist/browser/modules/word/query/search.js +346 -0
- package/dist/browser/modules/word/query/split.d.ts +44 -0
- package/dist/browser/modules/word/query/split.js +135 -0
- package/dist/browser/modules/word/query/style-resolve.d.ts +104 -0
- package/dist/browser/modules/word/query/style-resolve.js +368 -0
- package/dist/browser/modules/word/reader/chart-parser.d.ts +20 -0
- package/dist/browser/modules/word/reader/chart-parser.js +810 -0
- package/dist/browser/modules/word/reader/comments-parser.d.ts +26 -0
- package/dist/browser/modules/word/reader/comments-parser.js +92 -0
- package/dist/browser/modules/word/reader/doc-props-parsers.d.ts +15 -0
- package/dist/browser/modules/word/reader/doc-props-parsers.js +190 -0
- package/dist/browser/modules/word/reader/docx-reader.d.ts +27 -0
- package/dist/browser/modules/word/reader/docx-reader.js +2557 -0
- package/dist/browser/modules/word/reader/drawing-helpers.d.ts +27 -0
- package/dist/browser/modules/word/reader/drawing-helpers.js +84 -0
- package/dist/browser/modules/word/reader/form-field-parser.d.ts +21 -0
- package/dist/browser/modules/word/reader/form-field-parser.js +82 -0
- package/dist/browser/modules/word/reader/image-parsers.d.ts +11 -0
- package/dist/browser/modules/word/reader/image-parsers.js +291 -0
- package/dist/browser/modules/word/reader/math-parser.d.ts +12 -0
- package/dist/browser/modules/word/reader/math-parser.js +422 -0
- package/dist/browser/modules/word/reader/metadata-parsers.d.ts +17 -0
- package/dist/browser/modules/word/reader/metadata-parsers.js +87 -0
- package/dist/browser/modules/word/reader/numbering-parser.d.ts +13 -0
- package/dist/browser/modules/word/reader/numbering-parser.js +166 -0
- package/dist/browser/modules/word/reader/paragraph-section-parsers.d.ts +12 -0
- package/dist/browser/modules/word/reader/paragraph-section-parsers.js +503 -0
- package/dist/browser/modules/word/reader/parse-utils.d.ts +91 -0
- package/dist/browser/modules/word/reader/parse-utils.js +249 -0
- package/dist/browser/modules/word/reader/properties-parsers.d.ts +21 -0
- package/dist/browser/modules/word/reader/properties-parsers.js +332 -0
- package/dist/browser/modules/word/reader/reader-context.d.ts +69 -0
- package/dist/browser/modules/word/reader/reader-context.js +61 -0
- package/dist/browser/modules/word/reader/sdt-helpers.d.ts +29 -0
- package/dist/browser/modules/word/reader/sdt-helpers.js +111 -0
- package/dist/browser/modules/word/reader/settings-parser.d.ts +8 -0
- package/dist/browser/modules/word/reader/settings-parser.js +263 -0
- package/dist/browser/modules/word/reader/styles-parser.d.ts +12 -0
- package/dist/browser/modules/word/reader/styles-parser.js +147 -0
- package/dist/browser/modules/word/reader/table-properties-parsers.d.ts +12 -0
- package/dist/browser/modules/word/reader/table-properties-parsers.js +234 -0
- package/dist/browser/modules/word/reader/theme-parser.d.ts +8 -0
- package/dist/browser/modules/word/reader/theme-parser.js +167 -0
- package/dist/browser/modules/word/reader/watermark-parser.d.ts +15 -0
- package/dist/browser/modules/word/reader/watermark-parser.js +110 -0
- package/dist/browser/modules/word/security/cfb-reader.d.ts +37 -0
- package/dist/browser/modules/word/security/cfb-reader.js +410 -0
- package/dist/browser/modules/word/{digital-signatures.d.ts → security/digital-signatures.d.ts} +19 -11
- package/dist/browser/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
- package/dist/browser/modules/word/security/document-protection.d.ts +93 -0
- package/dist/browser/modules/word/security/document-protection.js +201 -0
- package/dist/{types/modules/word → browser/modules/word/security}/encryption.d.ts +51 -4
- package/dist/browser/modules/word/security/encryption.js +602 -0
- package/dist/browser/modules/word/security/policy.d.ts +80 -0
- package/dist/browser/modules/word/security/policy.js +102 -0
- package/dist/browser/modules/word/template/template-chart.d.ts +56 -0
- package/dist/browser/modules/word/template/template-chart.js +167 -0
- package/dist/browser/modules/word/template/template-datasource.d.ts +154 -0
- package/dist/browser/modules/word/template/template-datasource.js +541 -0
- package/dist/browser/modules/word/template/template-engine.d.ts +121 -0
- package/dist/browser/modules/word/template/template-engine.js +1435 -0
- package/dist/browser/modules/word/types.d.ts +224 -25
- package/dist/browser/modules/word/units.d.ts +26 -0
- package/dist/browser/modules/word/units.js +43 -14
- package/dist/browser/modules/word/{writers → writer}/chart-writer.js +164 -23
- package/dist/browser/modules/word/writer/checkbox-writer.d.ts +17 -0
- package/dist/browser/modules/word/writer/checkbox-writer.js +79 -0
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/comment-writer.d.ts +2 -1
- package/dist/browser/modules/word/{writers → writer}/comment-writer.js +8 -6
- package/dist/browser/modules/word/writer/common-parts.d.ts +57 -0
- package/dist/browser/modules/word/writer/common-parts.js +101 -0
- package/dist/{types/modules/word → browser/modules/word/writer}/content-types.d.ts +2 -2
- package/dist/{esm/modules/word → browser/modules/word/writer}/content-types.js +14 -6
- package/dist/browser/modules/word/writer/document-writer.d.ts +24 -0
- package/dist/browser/modules/word/writer/document-writer.js +473 -0
- package/dist/browser/modules/word/writer/docx-packager.d.ts +35 -0
- package/dist/browser/modules/word/writer/docx-packager.js +1515 -0
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/footnote-writer.d.ts +3 -2
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/footnote-writer.js +13 -10
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/header-footer-writer.d.ts +3 -2
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/header-footer-writer.js +39 -21
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/image-writer.d.ts +1 -1
- package/dist/browser/modules/word/{writers → writer}/image-writer.js +11 -7
- package/dist/browser/modules/word/writer/math-writer.d.ts +20 -0
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/math-writer.js +21 -1
- package/dist/browser/modules/word/{writers → writer}/numbering-writer.d.ts +1 -1
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/numbering-writer.js +11 -4
- package/dist/browser/modules/word/{writers → writer}/paragraph-writer.d.ts +2 -1
- package/dist/browser/modules/word/{writers → writer}/paragraph-writer.js +73 -38
- package/dist/browser/modules/word/{writers → writer}/parts-writer.d.ts +3 -3
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/parts-writer.js +91 -12
- package/dist/browser/modules/word/writer/reference-scanners.d.ts +42 -0
- package/dist/browser/modules/word/writer/reference-scanners.js +111 -0
- package/dist/browser/modules/word/writer/relationships.d.ts +52 -0
- package/dist/browser/modules/word/writer/relationships.js +117 -0
- package/dist/browser/modules/word/writer/render-context.d.ts +124 -0
- package/dist/browser/modules/word/writer/render-context.js +46 -0
- package/dist/browser/modules/word/{writers → writer}/run-writer.d.ts +10 -1
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/run-writer.js +126 -24
- package/dist/browser/modules/word/writer/sdt-writer.d.ts +25 -0
- package/dist/browser/modules/word/writer/sdt-writer.js +189 -0
- package/dist/browser/modules/word/writer/stream-buf.d.ts +37 -0
- package/dist/browser/modules/word/writer/stream-buf.js +73 -0
- package/dist/browser/modules/word/writer/streaming-writer.d.ts +344 -0
- package/dist/browser/modules/word/writer/streaming-writer.js +1382 -0
- package/dist/browser/modules/word/writer/string-buf.d.ts +8 -0
- package/dist/browser/modules/word/writer/string-buf.js +7 -0
- package/dist/browser/modules/word/{writers → writer}/styles-writer.js +32 -1
- package/dist/browser/modules/word/{writers → writer}/table-writer.d.ts +2 -1
- package/dist/browser/modules/word/{writers → writer}/table-writer.js +94 -11
- package/dist/browser/modules/xml/types.d.ts +22 -0
- package/dist/browser/utils/crypto.browser.d.ts +3 -1
- package/dist/browser/utils/crypto.browser.js +3 -1
- package/dist/browser/utils/crypto.d.ts +4 -1
- package/dist/browser/utils/crypto.js +4 -1
- package/dist/browser/utils/font-metrics.d.ts +63 -0
- package/dist/browser/utils/font-metrics.js +293 -0
- package/dist/browser/utils/string-buf.d.ts +42 -0
- package/dist/browser/utils/string-buf.js +89 -0
- package/dist/browser/utils/theme-colors.d.ts +55 -0
- package/dist/browser/utils/theme-colors.js +120 -0
- package/dist/cjs/modules/archive/compression/streaming-compress.browser.js +29 -0
- package/dist/cjs/modules/archive/compression/streaming-compress.js +9 -0
- package/dist/cjs/modules/archive/compression/worker-pool/pool.browser.js +26 -1
- package/dist/cjs/modules/archive/fs/archive-file.js +78 -16
- package/dist/cjs/modules/archive/unzip/stream.browser.js +43 -2
- package/dist/cjs/modules/excel/chart/chart-ex-builder.js +7 -2
- package/dist/cjs/modules/excel/chart/chart-ex-renderer.js +4 -9
- package/dist/cjs/modules/excel/chart/chart.js +1 -7
- package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +25 -1
- package/dist/cjs/modules/excel/stream/workbook-reader.js +9 -0
- package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +228 -13
- package/dist/cjs/modules/excel/utils/string-buf.js +5 -81
- package/dist/cjs/modules/excel/workbook.browser.js +135 -25
- package/dist/cjs/modules/excel/xlsx/xform/chart/chart-space-xform.js +6 -20
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +32 -8
- package/dist/cjs/modules/excel/xlsx/xlsx.js +9 -1
- package/dist/cjs/modules/pdf/excel-bridge.js +33 -0
- package/dist/cjs/modules/pdf/font/metrics.js +11 -244
- package/dist/cjs/modules/pdf/index.js +2 -1
- package/dist/cjs/modules/pdf/render-layout-to-pdf.js +651 -0
- package/dist/cjs/modules/pdf/word-bridge.js +155 -274
- package/dist/cjs/modules/stream/index.base.js +4 -2
- package/dist/cjs/modules/stream/internal/sink-adapter.js +202 -0
- package/dist/cjs/modules/stream/pull-stream.js +51 -5
- package/dist/cjs/modules/word/advanced/diff.js +170 -0
- package/dist/cjs/modules/word/advanced/drawing-shapes.js +279 -0
- package/dist/cjs/modules/word/advanced/field-engine.js +1229 -0
- package/dist/cjs/modules/word/advanced/glossary.js +87 -0
- package/dist/cjs/modules/word/advanced/math-convert.js +599 -0
- package/dist/cjs/modules/word/advanced/ole-objects.js +277 -0
- package/dist/cjs/modules/word/advanced/style-map.js +329 -0
- package/dist/cjs/modules/word/advanced/validation.js +1068 -0
- package/dist/cjs/modules/word/advanced/vba-project.js +274 -0
- package/dist/cjs/modules/word/bridge/excel-bridge.js +1020 -0
- package/dist/cjs/modules/word/builder/document-handle.js +667 -0
- package/dist/cjs/modules/word/builder/paragraph-builders.js +109 -0
- package/dist/cjs/modules/word/builder/run-builders.js +676 -0
- package/dist/cjs/modules/word/builder/table-builders.js +53 -0
- package/dist/cjs/modules/word/constants.js +111 -2
- package/dist/cjs/modules/word/convert/conversion-ir.js +34 -0
- package/dist/cjs/modules/word/convert/docx-to-semantic.js +502 -0
- package/dist/cjs/modules/word/convert/flat-opc.js +390 -0
- package/dist/cjs/modules/word/convert/html/html-import.js +1910 -0
- package/dist/cjs/modules/word/{html-renderer.js → convert/html/html-renderer.js} +420 -69
- package/dist/cjs/modules/word/convert/html/html.js +20 -0
- package/dist/cjs/modules/word/convert/markdown/markdown-import.js +1329 -0
- package/dist/cjs/modules/word/convert/markdown/markdown-renderer.js +637 -0
- package/dist/cjs/modules/word/convert/markdown/markdown.js +21 -0
- package/dist/cjs/modules/word/convert/odt/odt.js +1936 -0
- package/dist/cjs/modules/word/core/color-utils.js +47 -0
- package/dist/cjs/modules/word/core/internal-utils.js +219 -0
- package/dist/cjs/modules/word/core/mapper.js +430 -0
- package/dist/cjs/modules/word/core/opc-paths.js +53 -0
- package/dist/cjs/modules/word/core/text-utils.js +210 -0
- package/dist/cjs/modules/word/core/walker.js +577 -0
- package/dist/cjs/modules/word/crypto.js +19 -8
- package/dist/cjs/modules/word/document-io.js +117 -197
- package/dist/cjs/modules/word/errors.js +59 -13
- package/dist/cjs/modules/word/excel.js +22 -0
- package/dist/cjs/modules/word/font/font-embed.js +652 -0
- package/dist/cjs/modules/word/{font-obfuscation.js → font/font-obfuscation.js} +4 -9
- package/dist/cjs/modules/word/font/hyphenation.js +4216 -0
- package/dist/cjs/modules/word/font/text-shaping.js +640 -0
- package/dist/cjs/modules/word/html.js +9 -7
- package/dist/cjs/modules/word/incremental-edit.js +366 -0
- package/dist/cjs/modules/word/index.base.js +370 -137
- package/dist/cjs/modules/word/layout/layout-constants.js +20 -0
- package/dist/cjs/modules/word/layout/layout-full.js +1699 -0
- package/dist/cjs/modules/word/layout/layout-model.js +17 -0
- package/dist/cjs/modules/word/layout/layout.js +1170 -0
- package/dist/cjs/modules/word/layout/render-page.js +1243 -0
- package/dist/cjs/modules/word/markdown.js +19 -0
- package/dist/cjs/modules/word/patcher.js +539 -0
- package/dist/cjs/modules/word/query/compat.js +61 -0
- package/dist/cjs/modules/word/query/data-binding.js +395 -0
- package/dist/cjs/modules/word/query/form-fields.js +272 -0
- package/dist/cjs/modules/word/query/format-search.js +334 -0
- package/dist/cjs/modules/word/query/mail-merge.js +114 -0
- package/dist/cjs/modules/word/query/merge.js +620 -0
- package/dist/cjs/modules/word/query/replace.js +304 -0
- package/dist/cjs/modules/word/query/revisions.js +885 -0
- package/dist/cjs/modules/word/query/search.js +361 -0
- package/dist/cjs/modules/word/query/split.js +138 -0
- package/dist/cjs/modules/word/query/style-resolve.js +374 -0
- package/dist/cjs/modules/word/reader/chart-parser.js +814 -0
- package/dist/cjs/modules/word/reader/comments-parser.js +96 -0
- package/dist/cjs/modules/word/reader/doc-props-parsers.js +194 -0
- package/dist/cjs/modules/word/reader/docx-reader.js +2560 -0
- package/dist/cjs/modules/word/reader/drawing-helpers.js +90 -0
- package/dist/cjs/modules/word/reader/form-field-parser.js +85 -0
- package/dist/cjs/modules/word/reader/image-parsers.js +293 -0
- package/dist/cjs/modules/word/reader/math-parser.js +424 -0
- package/dist/cjs/modules/word/reader/metadata-parsers.js +93 -0
- package/dist/cjs/modules/word/reader/numbering-parser.js +168 -0
- package/dist/cjs/modules/word/reader/paragraph-section-parsers.js +505 -0
- package/dist/cjs/modules/word/reader/parse-utils.js +271 -0
- package/dist/cjs/modules/word/reader/properties-parsers.js +338 -0
- package/dist/cjs/modules/word/reader/reader-context.js +66 -0
- package/dist/cjs/modules/word/reader/sdt-helpers.js +114 -0
- package/dist/cjs/modules/word/reader/settings-parser.js +265 -0
- package/dist/cjs/modules/word/reader/styles-parser.js +149 -0
- package/dist/cjs/modules/word/reader/table-properties-parsers.js +237 -0
- package/dist/cjs/modules/word/reader/theme-parser.js +169 -0
- package/dist/cjs/modules/word/reader/watermark-parser.js +113 -0
- package/dist/cjs/modules/word/security/cfb-reader.js +414 -0
- package/dist/cjs/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
- package/dist/cjs/modules/word/security/document-protection.js +208 -0
- package/dist/cjs/modules/word/security/encryption.js +612 -0
- package/dist/cjs/modules/word/security/policy.js +106 -0
- package/dist/cjs/modules/word/template/template-chart.js +170 -0
- package/dist/cjs/modules/word/template/template-datasource.js +549 -0
- package/dist/cjs/modules/word/template/template-engine.js +1430 -0
- package/dist/cjs/modules/word/units.js +44 -14
- package/dist/cjs/modules/word/{writers → writer}/chart-writer.js +163 -22
- package/dist/cjs/modules/word/writer/checkbox-writer.js +82 -0
- package/dist/cjs/modules/word/{writers → writer}/comment-writer.js +8 -6
- package/dist/cjs/modules/word/writer/common-parts.js +104 -0
- package/dist/cjs/modules/word/{content-types.js → writer/content-types.js} +14 -6
- package/dist/cjs/modules/word/writer/document-writer.js +478 -0
- package/dist/cjs/modules/word/writer/docx-packager.js +1551 -0
- package/dist/cjs/modules/word/{writers → writer}/footnote-writer.js +13 -10
- package/dist/cjs/modules/word/{writers → writer}/header-footer-writer.js +38 -20
- package/dist/cjs/modules/word/{writers → writer}/image-writer.js +11 -7
- package/dist/cjs/modules/word/{writers → writer}/math-writer.js +21 -1
- package/dist/cjs/modules/word/{writers → writer}/numbering-writer.js +11 -4
- package/dist/cjs/modules/word/{writers → writer}/paragraph-writer.js +72 -37
- package/dist/cjs/modules/word/{writers → writer}/parts-writer.js +91 -12
- package/dist/cjs/modules/word/writer/reference-scanners.js +120 -0
- package/dist/cjs/modules/word/writer/relationships.js +124 -0
- package/dist/cjs/modules/word/writer/render-context.js +51 -0
- package/dist/cjs/modules/word/{writers → writer}/run-writer.js +127 -24
- package/dist/cjs/modules/word/writer/sdt-writer.js +192 -0
- package/dist/cjs/modules/word/writer/stream-buf.js +76 -0
- package/dist/cjs/modules/word/writer/streaming-writer.js +1387 -0
- package/dist/cjs/modules/word/writer/string-buf.js +11 -0
- package/dist/cjs/modules/word/{writers → writer}/styles-writer.js +32 -1
- package/dist/cjs/modules/word/{writers → writer}/table-writer.js +94 -11
- package/dist/cjs/utils/crypto.browser.js +3 -1
- package/dist/cjs/utils/crypto.js +4 -1
- package/dist/cjs/utils/font-metrics.js +303 -0
- package/dist/cjs/utils/string-buf.js +92 -0
- package/dist/cjs/utils/theme-colors.js +126 -0
- package/dist/esm/modules/archive/compression/streaming-compress.browser.js +29 -0
- package/dist/esm/modules/archive/compression/streaming-compress.js +9 -0
- package/dist/esm/modules/archive/compression/worker-pool/pool.browser.js +26 -1
- package/dist/esm/modules/archive/fs/archive-file.js +78 -16
- package/dist/esm/modules/archive/unzip/stream.browser.js +43 -2
- package/dist/esm/modules/excel/chart/chart-ex-builder.js +7 -2
- package/dist/esm/modules/excel/chart/chart-ex-renderer.js +4 -9
- package/dist/esm/modules/excel/chart/chart.js +1 -7
- package/dist/esm/modules/excel/stream/workbook-reader.browser.js +25 -1
- package/dist/esm/modules/excel/stream/workbook-reader.js +9 -0
- package/dist/esm/modules/excel/stream/workbook-writer.browser.js +228 -13
- package/dist/esm/modules/excel/utils/string-buf.js +4 -81
- package/dist/esm/modules/excel/workbook.browser.js +135 -25
- package/dist/esm/modules/excel/xlsx/xform/chart/chart-space-xform.js +6 -20
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +32 -8
- package/dist/esm/modules/excel/xlsx/xlsx.js +9 -1
- package/dist/esm/modules/pdf/excel-bridge.js +32 -0
- package/dist/esm/modules/pdf/font/metrics.js +3 -237
- package/dist/esm/modules/pdf/index.js +1 -1
- package/dist/esm/modules/pdf/render-layout-to-pdf.js +647 -0
- package/dist/esm/modules/pdf/word-bridge.js +122 -274
- package/dist/esm/modules/stream/index.base.js +2 -1
- package/dist/esm/modules/stream/internal/sink-adapter.js +198 -0
- package/dist/esm/modules/stream/pull-stream.js +51 -5
- package/dist/esm/modules/word/advanced/diff.js +167 -0
- package/dist/esm/modules/word/advanced/drawing-shapes.js +268 -0
- package/dist/esm/modules/word/advanced/field-engine.js +1225 -0
- package/dist/esm/modules/word/advanced/glossary.js +79 -0
- package/dist/esm/modules/word/advanced/math-convert.js +595 -0
- package/dist/esm/modules/word/advanced/ole-objects.js +271 -0
- package/dist/esm/modules/word/advanced/style-map.js +322 -0
- package/dist/esm/modules/word/advanced/validation.js +1065 -0
- package/dist/esm/modules/word/advanced/vba-project.js +265 -0
- package/dist/esm/modules/word/bridge/excel-bridge.js +980 -0
- package/dist/esm/modules/word/builder/document-handle.js +664 -0
- package/dist/esm/modules/word/builder/paragraph-builders.js +90 -0
- package/dist/esm/modules/word/builder/run-builders.js +600 -0
- package/dist/esm/modules/word/builder/table-builders.js +45 -0
- package/dist/esm/modules/word/constants.js +109 -1
- package/dist/esm/modules/word/convert/conversion-ir.js +31 -0
- package/dist/esm/modules/word/convert/docx-to-semantic.js +499 -0
- package/dist/esm/modules/word/convert/flat-opc.js +385 -0
- package/dist/esm/modules/word/convert/html/html-import.js +1907 -0
- package/dist/{browser/modules/word → esm/modules/word/convert/html}/html-renderer.js +420 -69
- package/dist/esm/modules/word/convert/html/html.js +15 -0
- package/dist/esm/modules/word/convert/markdown/markdown-import.js +1325 -0
- package/dist/esm/modules/word/convert/markdown/markdown-renderer.js +634 -0
- package/dist/esm/modules/word/convert/markdown/markdown.js +15 -0
- package/dist/esm/modules/word/convert/odt/odt.js +1932 -0
- package/dist/esm/modules/word/core/color-utils.js +43 -0
- package/dist/esm/modules/word/core/internal-utils.js +209 -0
- package/dist/esm/modules/word/core/mapper.js +427 -0
- package/dist/esm/modules/word/core/opc-paths.js +48 -0
- package/dist/esm/modules/word/core/text-utils.js +202 -0
- package/dist/esm/modules/word/core/walker.js +570 -0
- package/dist/esm/modules/word/crypto.js +13 -7
- package/dist/esm/modules/word/document-io.js +80 -197
- package/dist/esm/modules/word/errors.js +54 -2
- package/dist/esm/modules/word/excel.js +13 -0
- package/dist/esm/modules/word/font/font-embed.js +646 -0
- package/dist/{browser/modules/word → esm/modules/word/font}/font-obfuscation.js +4 -9
- package/dist/esm/modules/word/font/hyphenation.js +4210 -0
- package/dist/esm/modules/word/font/text-shaping.js +635 -0
- package/dist/esm/modules/word/html.js +6 -5
- package/dist/esm/modules/word/incremental-edit.js +361 -0
- package/dist/esm/modules/word/index.base.js +138 -29
- package/dist/esm/modules/word/layout/layout-constants.js +17 -0
- package/dist/esm/modules/word/layout/layout-full.js +1696 -0
- package/dist/esm/modules/word/layout/layout-model.js +16 -0
- package/dist/esm/modules/word/layout/layout.js +1167 -0
- package/dist/esm/modules/word/layout/render-page.js +1238 -0
- package/dist/esm/modules/word/markdown.js +13 -0
- package/dist/esm/modules/word/patcher.js +537 -0
- package/dist/esm/modules/word/query/compat.js +58 -0
- package/dist/esm/modules/word/query/data-binding.js +392 -0
- package/dist/esm/modules/word/query/form-fields.js +268 -0
- package/dist/esm/modules/word/query/format-search.js +329 -0
- package/dist/esm/modules/word/query/mail-merge.js +111 -0
- package/dist/esm/modules/word/query/merge.js +617 -0
- package/dist/esm/modules/word/query/replace.js +301 -0
- package/dist/esm/modules/word/query/revisions.js +879 -0
- package/dist/esm/modules/word/query/search.js +346 -0
- package/dist/esm/modules/word/query/split.js +135 -0
- package/dist/esm/modules/word/query/style-resolve.js +368 -0
- package/dist/esm/modules/word/reader/chart-parser.js +810 -0
- package/dist/esm/modules/word/reader/comments-parser.js +92 -0
- package/dist/esm/modules/word/reader/doc-props-parsers.js +190 -0
- package/dist/esm/modules/word/reader/docx-reader.js +2557 -0
- package/dist/esm/modules/word/reader/drawing-helpers.js +84 -0
- package/dist/esm/modules/word/reader/form-field-parser.js +82 -0
- package/dist/esm/modules/word/reader/image-parsers.js +291 -0
- package/dist/esm/modules/word/reader/math-parser.js +422 -0
- package/dist/esm/modules/word/reader/metadata-parsers.js +87 -0
- package/dist/esm/modules/word/reader/numbering-parser.js +166 -0
- package/dist/esm/modules/word/reader/paragraph-section-parsers.js +503 -0
- package/dist/esm/modules/word/reader/parse-utils.js +249 -0
- package/dist/esm/modules/word/reader/properties-parsers.js +332 -0
- package/dist/esm/modules/word/reader/reader-context.js +61 -0
- package/dist/esm/modules/word/reader/sdt-helpers.js +111 -0
- package/dist/esm/modules/word/reader/settings-parser.js +263 -0
- package/dist/esm/modules/word/reader/styles-parser.js +147 -0
- package/dist/esm/modules/word/reader/table-properties-parsers.js +234 -0
- package/dist/esm/modules/word/reader/theme-parser.js +167 -0
- package/dist/esm/modules/word/reader/watermark-parser.js +110 -0
- package/dist/esm/modules/word/security/cfb-reader.js +410 -0
- package/dist/esm/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
- package/dist/esm/modules/word/security/document-protection.js +201 -0
- package/dist/esm/modules/word/security/encryption.js +602 -0
- package/dist/esm/modules/word/security/policy.js +102 -0
- package/dist/esm/modules/word/template/template-chart.js +167 -0
- package/dist/esm/modules/word/template/template-datasource.js +541 -0
- package/dist/esm/modules/word/template/template-engine.js +1435 -0
- package/dist/esm/modules/word/units.js +43 -14
- package/dist/esm/modules/word/{writers → writer}/chart-writer.js +164 -23
- package/dist/esm/modules/word/writer/checkbox-writer.js +79 -0
- package/dist/esm/modules/word/{writers → writer}/comment-writer.js +8 -6
- package/dist/esm/modules/word/writer/common-parts.js +101 -0
- package/dist/{browser/modules/word → esm/modules/word/writer}/content-types.js +14 -6
- package/dist/esm/modules/word/writer/document-writer.js +473 -0
- package/dist/esm/modules/word/writer/docx-packager.js +1515 -0
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/footnote-writer.js +13 -10
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/header-footer-writer.js +39 -21
- package/dist/esm/modules/word/{writers → writer}/image-writer.js +11 -7
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/math-writer.js +21 -1
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/numbering-writer.js +11 -4
- package/dist/esm/modules/word/{writers → writer}/paragraph-writer.js +73 -38
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/parts-writer.js +91 -12
- package/dist/esm/modules/word/writer/reference-scanners.js +111 -0
- package/dist/esm/modules/word/writer/relationships.js +117 -0
- package/dist/esm/modules/word/writer/render-context.js +46 -0
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/run-writer.js +126 -24
- package/dist/esm/modules/word/writer/sdt-writer.js +189 -0
- package/dist/esm/modules/word/writer/stream-buf.js +73 -0
- package/dist/esm/modules/word/writer/streaming-writer.js +1382 -0
- package/dist/esm/modules/word/writer/string-buf.js +7 -0
- package/dist/esm/modules/word/{writers → writer}/styles-writer.js +32 -1
- package/dist/esm/modules/word/{writers → writer}/table-writer.js +94 -11
- package/dist/esm/utils/crypto.browser.js +3 -1
- package/dist/esm/utils/crypto.js +4 -1
- package/dist/esm/utils/font-metrics.js +293 -0
- package/dist/esm/utils/string-buf.js +89 -0
- package/dist/esm/utils/theme-colors.js +120 -0
- package/dist/iife/excelts.iife.js +70692 -70337
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +57 -57
- package/dist/types/modules/archive/fs/archive-file.d.ts +8 -5
- package/dist/types/modules/excel/chart/chart-ex-types.d.ts +0 -12
- package/dist/types/modules/excel/chart/chart.d.ts +1 -5
- package/dist/types/modules/excel/chart/types.d.ts +0 -6
- package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +40 -0
- package/dist/types/modules/excel/utils/string-buf.d.ts +5 -26
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +19 -9
- package/dist/types/modules/excel/xlsx/xlsx.d.ts +10 -2
- package/dist/types/modules/pdf/excel-bridge.d.ts +30 -1
- package/dist/types/modules/pdf/font/metrics.d.ts +3 -52
- package/dist/types/modules/pdf/index.d.ts +1 -1
- package/dist/types/modules/pdf/render-layout-to-pdf.d.ts +66 -0
- package/dist/types/modules/pdf/word-bridge.d.ts +80 -12
- package/dist/types/modules/stream/index.base.d.ts +2 -0
- package/dist/types/modules/stream/internal/sink-adapter.d.ts +65 -0
- package/dist/types/modules/stream/pull-stream.d.ts +19 -2
- package/dist/types/modules/stream/types.d.ts +13 -1
- package/dist/types/modules/word/advanced/diff.d.ts +61 -0
- package/dist/types/modules/word/advanced/drawing-shapes.d.ts +269 -0
- package/dist/types/modules/word/advanced/field-engine.d.ts +43 -0
- package/dist/types/modules/word/advanced/glossary.d.ts +86 -0
- package/dist/types/modules/word/advanced/math-convert.d.ts +30 -0
- package/dist/types/modules/word/advanced/ole-objects.d.ts +115 -0
- package/dist/types/modules/word/advanced/style-map.d.ts +105 -0
- package/dist/types/modules/word/advanced/validation.d.ts +56 -0
- package/dist/types/modules/word/advanced/vba-project.d.ts +91 -0
- package/dist/types/modules/word/bridge/excel-bridge.d.ts +127 -0
- package/dist/types/modules/word/builder/document-handle.d.ts +151 -0
- package/dist/types/modules/word/builder/paragraph-builders.d.ts +61 -0
- package/dist/types/modules/word/builder/run-builders.d.ts +374 -0
- package/dist/types/modules/word/builder/table-builders.d.ts +23 -0
- package/dist/types/modules/word/constants.d.ts +39 -1
- package/dist/types/modules/word/convert/conversion-ir.d.ts +210 -0
- package/dist/types/modules/word/convert/docx-to-semantic.d.ts +39 -0
- package/dist/types/modules/word/convert/flat-opc.d.ts +44 -0
- package/dist/types/modules/word/convert/html/html-import.d.ts +50 -0
- package/dist/{browser/modules/word → types/modules/word/convert/html}/html-renderer.d.ts +14 -1
- package/dist/types/modules/word/convert/html/html.d.ts +15 -0
- package/dist/types/modules/word/convert/markdown/markdown-import.d.ts +68 -0
- package/dist/types/modules/word/convert/markdown/markdown-renderer.d.ts +25 -0
- package/dist/types/modules/word/convert/markdown/markdown.d.ts +15 -0
- package/dist/types/modules/word/convert/odt/odt.d.ts +41 -0
- package/dist/types/modules/word/{color-utils.d.ts → core/color-utils.d.ts} +8 -1
- package/dist/types/modules/word/core/internal-utils.d.ts +90 -0
- package/dist/types/modules/word/core/mapper.d.ts +44 -0
- package/dist/types/modules/word/core/opc-paths.d.ts +33 -0
- package/dist/types/modules/word/core/text-utils.d.ts +38 -0
- package/dist/types/modules/word/core/walker.d.ts +119 -0
- package/dist/types/modules/word/crypto.d.ts +14 -9
- package/dist/types/modules/word/document-io.d.ts +59 -27
- package/dist/types/modules/word/errors.d.ts +44 -1
- package/dist/types/modules/word/excel.d.ts +14 -0
- package/dist/types/modules/word/font/font-embed.d.ts +112 -0
- package/dist/types/modules/word/font/hyphenation.d.ts +65 -0
- package/dist/types/modules/word/font/text-shaping.d.ts +58 -0
- package/dist/types/modules/word/html.d.ts +7 -6
- package/dist/types/modules/word/incremental-edit.d.ts +123 -0
- package/dist/types/modules/word/index.base.d.ts +194 -10
- package/dist/types/modules/word/layout/layout-constants.d.ts +17 -0
- package/dist/types/modules/word/layout/layout-full.d.ts +53 -0
- package/dist/types/modules/word/layout/layout-model.d.ts +344 -0
- package/dist/types/modules/word/layout/layout.d.ts +63 -0
- package/dist/types/modules/word/layout/render-page.d.ts +57 -0
- package/dist/types/modules/word/markdown.d.ts +14 -0
- package/dist/types/modules/word/patcher.d.ts +62 -0
- package/dist/types/modules/word/query/compat.d.ts +25 -0
- package/dist/types/modules/word/query/data-binding.d.ts +22 -0
- package/dist/types/modules/word/query/form-fields.d.ts +41 -0
- package/dist/types/modules/word/query/format-search.d.ts +99 -0
- package/dist/types/modules/word/query/mail-merge.d.ts +25 -0
- package/dist/types/modules/word/query/merge.d.ts +50 -0
- package/dist/types/modules/word/query/replace.d.ts +47 -0
- package/dist/types/modules/word/query/revisions.d.ts +67 -0
- package/dist/types/modules/word/query/search.d.ts +129 -0
- package/dist/types/modules/word/query/split.d.ts +44 -0
- package/dist/types/modules/word/query/style-resolve.d.ts +104 -0
- package/dist/types/modules/word/reader/chart-parser.d.ts +20 -0
- package/dist/types/modules/word/reader/comments-parser.d.ts +26 -0
- package/dist/types/modules/word/reader/doc-props-parsers.d.ts +15 -0
- package/dist/types/modules/word/reader/docx-reader.d.ts +27 -0
- package/dist/types/modules/word/reader/drawing-helpers.d.ts +27 -0
- package/dist/types/modules/word/reader/form-field-parser.d.ts +21 -0
- package/dist/types/modules/word/reader/image-parsers.d.ts +11 -0
- package/dist/types/modules/word/reader/math-parser.d.ts +12 -0
- package/dist/types/modules/word/reader/metadata-parsers.d.ts +17 -0
- package/dist/types/modules/word/reader/numbering-parser.d.ts +13 -0
- package/dist/types/modules/word/reader/paragraph-section-parsers.d.ts +12 -0
- package/dist/types/modules/word/reader/parse-utils.d.ts +91 -0
- package/dist/types/modules/word/reader/properties-parsers.d.ts +21 -0
- package/dist/types/modules/word/reader/reader-context.d.ts +69 -0
- package/dist/types/modules/word/reader/sdt-helpers.d.ts +29 -0
- package/dist/types/modules/word/reader/settings-parser.d.ts +8 -0
- package/dist/types/modules/word/reader/styles-parser.d.ts +12 -0
- package/dist/types/modules/word/reader/table-properties-parsers.d.ts +12 -0
- package/dist/types/modules/word/reader/theme-parser.d.ts +8 -0
- package/dist/types/modules/word/reader/watermark-parser.d.ts +15 -0
- package/dist/types/modules/word/security/cfb-reader.d.ts +37 -0
- package/dist/types/modules/word/{digital-signatures.d.ts → security/digital-signatures.d.ts} +19 -11
- package/dist/types/modules/word/security/document-protection.d.ts +93 -0
- package/dist/{browser/modules/word → types/modules/word/security}/encryption.d.ts +51 -4
- package/dist/types/modules/word/security/policy.d.ts +80 -0
- package/dist/types/modules/word/template/template-chart.d.ts +56 -0
- package/dist/types/modules/word/template/template-datasource.d.ts +154 -0
- package/dist/types/modules/word/template/template-engine.d.ts +121 -0
- package/dist/types/modules/word/types.d.ts +224 -25
- package/dist/types/modules/word/units.d.ts +26 -0
- package/dist/types/modules/word/writer/checkbox-writer.d.ts +17 -0
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/comment-writer.d.ts +2 -1
- package/dist/types/modules/word/writer/common-parts.d.ts +57 -0
- package/dist/{browser/modules/word → types/modules/word/writer}/content-types.d.ts +2 -2
- package/dist/types/modules/word/writer/document-writer.d.ts +24 -0
- package/dist/types/modules/word/writer/docx-packager.d.ts +35 -0
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/footnote-writer.d.ts +3 -2
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/header-footer-writer.d.ts +3 -2
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/image-writer.d.ts +1 -1
- package/dist/types/modules/word/writer/math-writer.d.ts +20 -0
- package/dist/types/modules/word/{writers → writer}/numbering-writer.d.ts +1 -1
- package/dist/types/modules/word/{writers → writer}/paragraph-writer.d.ts +2 -1
- package/dist/types/modules/word/{writers → writer}/parts-writer.d.ts +3 -3
- package/dist/types/modules/word/writer/reference-scanners.d.ts +42 -0
- package/dist/types/modules/word/writer/relationships.d.ts +52 -0
- package/dist/types/modules/word/writer/render-context.d.ts +124 -0
- package/dist/types/modules/word/{writers → writer}/run-writer.d.ts +10 -1
- package/dist/types/modules/word/writer/sdt-writer.d.ts +25 -0
- package/dist/types/modules/word/writer/stream-buf.d.ts +37 -0
- package/dist/types/modules/word/writer/streaming-writer.d.ts +344 -0
- package/dist/types/modules/word/writer/string-buf.d.ts +8 -0
- package/dist/types/modules/word/{writers → writer}/table-writer.d.ts +2 -1
- package/dist/types/modules/xml/types.d.ts +22 -0
- package/dist/types/utils/crypto.browser.d.ts +3 -1
- package/dist/types/utils/crypto.d.ts +4 -1
- package/dist/types/utils/font-metrics.d.ts +63 -0
- package/dist/types/utils/string-buf.d.ts +42 -0
- package/dist/types/utils/theme-colors.d.ts +55 -0
- package/package.json +121 -39
- package/dist/browser/modules/word/color-utils.js +0 -94
- package/dist/browser/modules/word/document.d.ts +0 -657
- package/dist/browser/modules/word/document.js +0 -1533
- package/dist/browser/modules/word/docx-packager.d.ts +0 -14
- package/dist/browser/modules/word/docx-packager.js +0 -822
- package/dist/browser/modules/word/docx-reader.d.ts +0 -11
- package/dist/browser/modules/word/docx-reader.js +0 -4929
- package/dist/browser/modules/word/encryption.js +0 -274
- package/dist/browser/modules/word/internal-utils.d.ts +0 -23
- package/dist/browser/modules/word/internal-utils.js +0 -54
- package/dist/browser/modules/word/namespaces.d.ts +0 -159
- package/dist/browser/modules/word/namespaces.js +0 -189
- package/dist/browser/modules/word/relationships.d.ts +0 -30
- package/dist/browser/modules/word/relationships.js +0 -48
- package/dist/browser/modules/word/writers/checkbox-writer.d.ts +0 -9
- package/dist/browser/modules/word/writers/checkbox-writer.js +0 -42
- package/dist/browser/modules/word/writers/document-writer.d.ts +0 -16
- package/dist/browser/modules/word/writers/document-writer.js +0 -461
- package/dist/browser/modules/word/writers/math-writer.d.ts +0 -9
- package/dist/cjs/modules/word/color-utils.js +0 -97
- package/dist/cjs/modules/word/document.js +0 -1645
- package/dist/cjs/modules/word/docx-packager.js +0 -825
- package/dist/cjs/modules/word/docx-reader.js +0 -4932
- package/dist/cjs/modules/word/encryption.js +0 -282
- package/dist/cjs/modules/word/internal-utils.js +0 -59
- package/dist/cjs/modules/word/namespaces.js +0 -192
- package/dist/cjs/modules/word/relationships.js +0 -55
- package/dist/cjs/modules/word/writers/checkbox-writer.js +0 -45
- package/dist/cjs/modules/word/writers/document-writer.js +0 -465
- package/dist/esm/modules/word/color-utils.js +0 -94
- package/dist/esm/modules/word/document.js +0 -1533
- package/dist/esm/modules/word/docx-packager.js +0 -822
- package/dist/esm/modules/word/docx-reader.js +0 -4929
- package/dist/esm/modules/word/encryption.js +0 -274
- package/dist/esm/modules/word/internal-utils.js +0 -54
- package/dist/esm/modules/word/namespaces.js +0 -189
- package/dist/esm/modules/word/relationships.js +0 -48
- package/dist/esm/modules/word/writers/checkbox-writer.js +0 -42
- package/dist/esm/modules/word/writers/document-writer.js +0 -461
- package/dist/types/modules/word/document.d.ts +0 -657
- package/dist/types/modules/word/docx-packager.d.ts +0 -14
- package/dist/types/modules/word/docx-reader.d.ts +0 -11
- package/dist/types/modules/word/internal-utils.d.ts +0 -23
- package/dist/types/modules/word/namespaces.d.ts +0 -159
- package/dist/types/modules/word/relationships.d.ts +0 -30
- package/dist/types/modules/word/writers/checkbox-writer.d.ts +0 -9
- package/dist/types/modules/word/writers/document-writer.d.ts +0 -16
- package/dist/types/modules/word/writers/math-writer.d.ts +0 -9
- /package/dist/browser/modules/word/{font-obfuscation.d.ts → font/font-obfuscation.d.ts} +0 -0
- /package/dist/browser/modules/word/{writers → writer}/chart-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/section-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/section-writer.js +0 -0
- /package/dist/browser/modules/word/{writers → writer}/styles-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/textbox-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/textbox-writer.js +0 -0
- /package/dist/browser/modules/word/{writers → writer}/toc-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/toc-writer.js +0 -0
- /package/dist/cjs/modules/word/{writers → writer}/section-writer.js +0 -0
- /package/dist/cjs/modules/word/{writers → writer}/textbox-writer.js +0 -0
- /package/dist/cjs/modules/word/{writers → writer}/toc-writer.js +0 -0
- /package/dist/esm/modules/word/{writers → writer}/section-writer.js +0 -0
- /package/dist/esm/modules/word/{writers → writer}/textbox-writer.js +0 -0
- /package/dist/esm/modules/word/{writers → writer}/toc-writer.js +0 -0
- /package/dist/types/modules/word/{font-obfuscation.d.ts → font/font-obfuscation.d.ts} +0 -0
- /package/dist/types/modules/word/{writers → writer}/chart-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/section-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/styles-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/textbox-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/toc-writer.d.ts +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export of the shared {@link StringBuf} from `@utils/string-buf`.
|
|
3
|
+
*
|
|
4
|
+
* Kept as a thin alias so existing relative imports (`./string-buf`) within
|
|
5
|
+
* the word writer continue to work without churn.
|
|
6
|
+
*/
|
|
7
|
+
export { StringBuf } from "../../../utils/string-buf.js";
|
|
8
|
+
export type { StringBufOptions } from "../../../utils/string-buf.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export of the shared {@link StringBuf} from `@utils/string-buf`.
|
|
3
|
+
*
|
|
4
|
+
* Kept as a thin alias so existing relative imports (`./string-buf`) within
|
|
5
|
+
* the word writer continue to work without churn.
|
|
6
|
+
*/
|
|
7
|
+
export { StringBuf } from "../../../utils/string-buf.js";
|
|
@@ -61,12 +61,43 @@ function renderTableStyleCondition(xml, condition) {
|
|
|
61
61
|
renderShading(xml, condition.cellProperties.shading);
|
|
62
62
|
}
|
|
63
63
|
if (condition.cellProperties.borders) {
|
|
64
|
-
|
|
64
|
+
renderCellBordersInStyle(xml, condition.cellProperties.borders);
|
|
65
65
|
}
|
|
66
66
|
xml.closeNode();
|
|
67
67
|
}
|
|
68
68
|
xml.closeNode();
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Render cell borders inside a style definition (w:tcBorders).
|
|
72
|
+
* Cell-level border container is `w:tcBorders`, not `w:tblBorders` — using
|
|
73
|
+
* the wrong wrapper produces invalid styles.xml that Word silently ignores.
|
|
74
|
+
*/
|
|
75
|
+
function renderCellBordersInStyle(xml, borders) {
|
|
76
|
+
xml.openNode("w:tcBorders");
|
|
77
|
+
for (const side of [
|
|
78
|
+
"top",
|
|
79
|
+
"left",
|
|
80
|
+
"bottom",
|
|
81
|
+
"right",
|
|
82
|
+
"insideH",
|
|
83
|
+
"insideV",
|
|
84
|
+
"start",
|
|
85
|
+
"end",
|
|
86
|
+
"tl2br",
|
|
87
|
+
"tr2bl"
|
|
88
|
+
]) {
|
|
89
|
+
const b = borders[side];
|
|
90
|
+
if (b) {
|
|
91
|
+
xml.leafNode(`w:${side}`, {
|
|
92
|
+
"w:val": b.style,
|
|
93
|
+
"w:sz": String(b.size ?? 4),
|
|
94
|
+
"w:space": String(b.space ?? 0),
|
|
95
|
+
"w:color": b.color ?? "auto"
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
xml.closeNode();
|
|
100
|
+
}
|
|
70
101
|
/** Render table borders inside a style definition. */
|
|
71
102
|
function renderTableBordersInStyle(xml, borders) {
|
|
72
103
|
xml.openNode("w:tblBorders");
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { XmlSink } from "../../xml/types.js";
|
|
8
8
|
import type { Table } from "../types.js";
|
|
9
|
+
import type { RenderHelpers } from "./render-context.js";
|
|
9
10
|
/** Render a w:tbl element. */
|
|
10
|
-
export declare function renderTable(xml: XmlSink, table: Table): void;
|
|
11
|
+
export declare function renderTable(xml: XmlSink, table: Table, helpers?: RenderHelpers): void;
|
|
@@ -322,6 +322,14 @@ function renderTableCellProperties(xml, cPr, insidePropertyChange = false) {
|
|
|
322
322
|
if (cPr.width) {
|
|
323
323
|
renderTableWidth(xml, "w:tcW", cPr.width);
|
|
324
324
|
}
|
|
325
|
+
else {
|
|
326
|
+
// OOXML's CT_TcPr.tcW is technically optional, but Word treats a
|
|
327
|
+
// missing <w:tcW> as a hard schema violation: it triggers the
|
|
328
|
+
// "content unreadable" repair dialog and silently drops the table.
|
|
329
|
+
// Emit a w:type="auto" placeholder so Word lays the cell out using
|
|
330
|
+
// the table-level grid widths.
|
|
331
|
+
xml.leafNode("w:tcW", { "w:w": "0", "w:type": "auto" });
|
|
332
|
+
}
|
|
325
333
|
if (cPr.gridSpan !== undefined && cPr.gridSpan > 1) {
|
|
326
334
|
xml.leafNode("w:gridSpan", { "w:val": String(cPr.gridSpan) });
|
|
327
335
|
}
|
|
@@ -412,12 +420,24 @@ function renderTableCellProperties(xml, cPr, insidePropertyChange = false) {
|
|
|
412
420
|
xml.closeNode();
|
|
413
421
|
}
|
|
414
422
|
/** Render a table cell. */
|
|
415
|
-
function renderTableCell(xml, cell) {
|
|
423
|
+
function renderTableCell(xml, cell, helpers) {
|
|
416
424
|
xml.openNode("w:tc");
|
|
425
|
+
// OOXML CT_Tc requires a <w:tcPr> with at least <w:tcW> for Word to
|
|
426
|
+
// accept the cell. If the model didn't supply any cell properties we
|
|
427
|
+
// synthesise a minimal <w:tcPr><w:tcW w:type="auto"/></w:tcPr>; if it
|
|
428
|
+
// did, renderTableCellProperties handles the missing-tcW fallback.
|
|
417
429
|
if (cell.properties) {
|
|
418
430
|
renderTableCellProperties(xml, cell.properties);
|
|
419
431
|
}
|
|
420
|
-
|
|
432
|
+
else {
|
|
433
|
+
xml.openNode("w:tcPr");
|
|
434
|
+
xml.leafNode("w:tcW", { "w:w": "0", "w:type": "auto" });
|
|
435
|
+
xml.closeNode();
|
|
436
|
+
}
|
|
437
|
+
// OOXML §17.4.66 (CT_Tc) requires every table cell to *end* with a
|
|
438
|
+
// <w:p>. An empty cell needs at least one <w:p>, and a cell whose last
|
|
439
|
+
// block is a nested <w:tbl> must have a trailing <w:p> after it — Word
|
|
440
|
+
// (and LibreOffice) reject the document otherwise.
|
|
421
441
|
if (cell.content.length === 0) {
|
|
422
442
|
xml.openNode("w:p");
|
|
423
443
|
xml.closeNode();
|
|
@@ -425,17 +445,22 @@ function renderTableCell(xml, cell) {
|
|
|
425
445
|
else {
|
|
426
446
|
for (const block of cell.content) {
|
|
427
447
|
if (block.type === "paragraph") {
|
|
428
|
-
renderParagraph(xml, block);
|
|
448
|
+
renderParagraph(xml, block, helpers);
|
|
429
449
|
}
|
|
430
450
|
else if (block.type === "table") {
|
|
431
|
-
renderTable(xml, block);
|
|
451
|
+
renderTable(xml, block, helpers);
|
|
432
452
|
}
|
|
433
453
|
}
|
|
454
|
+
const last = cell.content[cell.content.length - 1];
|
|
455
|
+
if (last && last.type === "table") {
|
|
456
|
+
xml.openNode("w:p");
|
|
457
|
+
xml.closeNode();
|
|
458
|
+
}
|
|
434
459
|
}
|
|
435
460
|
xml.closeNode();
|
|
436
461
|
}
|
|
437
462
|
/** Render a table row. */
|
|
438
|
-
function renderTableRow(xml, row) {
|
|
463
|
+
function renderTableRow(xml, row, helpers) {
|
|
439
464
|
xml.openNode("w:tr");
|
|
440
465
|
// Table property exception (w:tblPrEx) must come before w:trPr per schema
|
|
441
466
|
if (row.properties?.tblPrEx) {
|
|
@@ -445,7 +470,7 @@ function renderTableRow(xml, row) {
|
|
|
445
470
|
renderTableRowProperties(xml, row.properties);
|
|
446
471
|
}
|
|
447
472
|
for (const cell of row.cells) {
|
|
448
|
-
renderTableCell(xml, cell);
|
|
473
|
+
renderTableCell(xml, cell, helpers);
|
|
449
474
|
}
|
|
450
475
|
xml.closeNode();
|
|
451
476
|
}
|
|
@@ -483,21 +508,79 @@ function renderTablePropertiesEx(xml, ex) {
|
|
|
483
508
|
xml.closeNode();
|
|
484
509
|
}
|
|
485
510
|
/** Render a w:tbl element. */
|
|
486
|
-
export function renderTable(xml, table) {
|
|
511
|
+
export function renderTable(xml, table, helpers) {
|
|
487
512
|
xml.openNode("w:tbl");
|
|
488
513
|
if (table.properties) {
|
|
489
514
|
renderTableProperties(xml, table.properties);
|
|
490
515
|
}
|
|
491
|
-
// Column grid
|
|
516
|
+
// Column grid. ECMA-376 §17.4.49 requires <w:tblGrid> with at least one
|
|
517
|
+
// <w:gridCol>. When the caller did not supply explicit column widths we
|
|
518
|
+
// synthesise the grid by inferring the column count from the widest row
|
|
519
|
+
// (counting gridSpan + gridBefore + gridAfter) and dividing the table
|
|
520
|
+
// width evenly. This keeps the package valid for Word / LibreOffice
|
|
521
|
+
// even when authors used the convenience builders that don't compute
|
|
522
|
+
// a grid up front.
|
|
523
|
+
xml.openNode("w:tblGrid");
|
|
492
524
|
if (table.columnWidths && table.columnWidths.length > 0) {
|
|
493
|
-
xml.openNode("w:tblGrid");
|
|
494
525
|
for (const w of table.columnWidths) {
|
|
495
526
|
xml.leafNode("w:gridCol", { "w:w": String(w) });
|
|
496
527
|
}
|
|
497
|
-
xml.closeNode();
|
|
498
528
|
}
|
|
529
|
+
else {
|
|
530
|
+
const columnCount = Math.max(1, computeTableColumnCount(table));
|
|
531
|
+
const totalWidth = inferTableWidthInTwips(table.properties);
|
|
532
|
+
const colWidth = Math.max(1, Math.floor(totalWidth / columnCount));
|
|
533
|
+
for (let i = 0; i < columnCount; i++) {
|
|
534
|
+
xml.leafNode("w:gridCol", { "w:w": String(colWidth) });
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
xml.closeNode();
|
|
499
538
|
for (const row of table.rows) {
|
|
500
|
-
renderTableRow(xml, row);
|
|
539
|
+
renderTableRow(xml, row, helpers);
|
|
501
540
|
}
|
|
502
541
|
xml.closeNode();
|
|
503
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* Count the number of grid columns the table requires.
|
|
545
|
+
*
|
|
546
|
+
* Each cell occupies `gridSpan` columns (default 1); each row may also
|
|
547
|
+
* declare `gridBefore` / `gridAfter` to leave empty grid units on its sides.
|
|
548
|
+
* The grid must be wide enough for every row, so we take the maximum.
|
|
549
|
+
*/
|
|
550
|
+
function computeTableColumnCount(table) {
|
|
551
|
+
let max = 1;
|
|
552
|
+
for (const row of table.rows) {
|
|
553
|
+
let count = row.properties?.gridBefore ?? 0;
|
|
554
|
+
for (const cell of row.cells) {
|
|
555
|
+
count += cell.properties?.gridSpan ?? 1;
|
|
556
|
+
}
|
|
557
|
+
count += row.properties?.gridAfter ?? 0;
|
|
558
|
+
if (count > max) {
|
|
559
|
+
max = count;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return max;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Pick a sensible total width (in twips) for a synthesised tblGrid.
|
|
566
|
+
*
|
|
567
|
+
* - If the table specifies a `dxa` width, use it directly.
|
|
568
|
+
* - If it specifies a `pct` width, treat it as a fraction of a default
|
|
569
|
+
* page text area (US Letter minus 1" margins = 9 360 twips). A 5000/pct
|
|
570
|
+
* value (= 100%) maps to the full text area.
|
|
571
|
+
* - Otherwise default to the same 9 360 twips.
|
|
572
|
+
*/
|
|
573
|
+
function inferTableWidthInTwips(props) {
|
|
574
|
+
const TEXT_AREA_TWIPS = 9360;
|
|
575
|
+
const w = props?.width;
|
|
576
|
+
if (!w) {
|
|
577
|
+
return TEXT_AREA_TWIPS;
|
|
578
|
+
}
|
|
579
|
+
if (w.type === "dxa" && typeof w.value === "number" && w.value > 0) {
|
|
580
|
+
return w.value;
|
|
581
|
+
}
|
|
582
|
+
if (w.type === "pct" && typeof w.value === "number" && w.value > 0) {
|
|
583
|
+
return Math.round((w.value / 5000) * TEXT_AREA_TWIPS);
|
|
584
|
+
}
|
|
585
|
+
return TEXT_AREA_TWIPS;
|
|
586
|
+
}
|
|
@@ -214,6 +214,28 @@ export interface SaxOptions {
|
|
|
214
214
|
* Accepts strings or Uint8Array chunks.
|
|
215
215
|
* Compatible with Node.js Writable, browser WritableStream wrappers,
|
|
216
216
|
* and the project's own StreamBuf.
|
|
217
|
+
*
|
|
218
|
+
* **Backpressure caveat**: `write()` returns `void`. The XmlStreamWriter
|
|
219
|
+
* cannot signal or wait for backpressure on the target — it pushes
|
|
220
|
+
* chunks synchronously as the caller invokes `openNode`/`writeText`/etc.
|
|
221
|
+
*
|
|
222
|
+
* If the target is a slow sink (HTTP response, fs stream, etc), the
|
|
223
|
+
* caller is responsible for ensuring chunks are consumed at a rate
|
|
224
|
+
* matching production. Two safe patterns:
|
|
225
|
+
*
|
|
226
|
+
* 1. Wrap the target so `write()` buffers into a bounded queue and
|
|
227
|
+
* pause your XML production loop when the queue is full.
|
|
228
|
+
* 2. Use a small in-memory buffer as the `WritableTarget`, then ship
|
|
229
|
+
* the assembled bytes to the slow sink with proper backpressure
|
|
230
|
+
* (e.g. via `pipeline()`).
|
|
231
|
+
*
|
|
232
|
+
* `XmlStreamWriter` is used internally by excelts's xlsx writer. The xlsx
|
|
233
|
+
* writer wraps it in a backpressure-aware zip pipeline that awaits drain
|
|
234
|
+
* BETWEEN zip entries — so memory grows at most by one entry's worth of
|
|
235
|
+
* uncompressed XML before the producer is parked. Within a single very
|
|
236
|
+
* large worksheet entry the synchronous push pattern still applies; that
|
|
237
|
+
* is the practical bound on how much a slow user sink can buffer behind
|
|
238
|
+
* the xlsx writer.
|
|
217
239
|
*/
|
|
218
240
|
export interface WritableTarget {
|
|
219
241
|
write(chunk: string | Uint8Array): void;
|
|
@@ -19,7 +19,9 @@ export declare function sha256(input: Uint8Array): Uint8Array;
|
|
|
19
19
|
export declare function md5(input: Uint8Array): Uint8Array;
|
|
20
20
|
/**
|
|
21
21
|
* RC4 stream cipher.
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* Required by ISO 32000 for reading PDFs encrypted with the RC4 algorithm
|
|
24
|
+
* (PDF 1.4 standard handler V=1/V=2).
|
|
23
25
|
*/
|
|
24
26
|
export declare function rc4(key: Uint8Array, data: Uint8Array): Uint8Array;
|
|
25
27
|
/**
|
|
@@ -510,7 +510,9 @@ export function md5(input) {
|
|
|
510
510
|
// =============================================================================
|
|
511
511
|
/**
|
|
512
512
|
* RC4 stream cipher.
|
|
513
|
-
*
|
|
513
|
+
*
|
|
514
|
+
* Required by ISO 32000 for reading PDFs encrypted with the RC4 algorithm
|
|
515
|
+
* (PDF 1.4 standard handler V=1/V=2).
|
|
514
516
|
*/
|
|
515
517
|
export function rc4(key, data) {
|
|
516
518
|
const s = new Uint8Array(256);
|
|
@@ -67,7 +67,10 @@ export declare function aesCbcEncryptRaw(plaintext: Uint8Array, key: Uint8Array,
|
|
|
67
67
|
export declare function aesEcbEncrypt(block: Uint8Array, key: Uint8Array): Uint8Array;
|
|
68
68
|
/**
|
|
69
69
|
* RC4 stream cipher.
|
|
70
|
-
*
|
|
70
|
+
*
|
|
71
|
+
* Required by ISO 32000 for reading PDFs encrypted with the RC4 algorithm
|
|
72
|
+
* (PDF 1.4 standard handler V=1/V=2). Modern Node `crypto` no longer
|
|
73
|
+
* exposes RC4, so this is a pure-JS implementation.
|
|
71
74
|
*/
|
|
72
75
|
export declare function rc4(key: Uint8Array, data: Uint8Array): Uint8Array;
|
|
73
76
|
/**
|
|
@@ -124,7 +124,10 @@ export function aesEcbEncrypt(block, key) {
|
|
|
124
124
|
// =============================================================================
|
|
125
125
|
/**
|
|
126
126
|
* RC4 stream cipher.
|
|
127
|
-
*
|
|
127
|
+
*
|
|
128
|
+
* Required by ISO 32000 for reading PDFs encrypted with the RC4 algorithm
|
|
129
|
+
* (PDF 1.4 standard handler V=1/V=2). Modern Node `crypto` no longer
|
|
130
|
+
* exposes RC4, so this is a pure-JS implementation.
|
|
128
131
|
*/
|
|
129
132
|
export function rc4(key, data) {
|
|
130
133
|
// Node's crypto doesn't expose RC4 in modern versions, use pure JS
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Font Metrics — shared between Word layout and PDF rendering.
|
|
3
|
+
*
|
|
4
|
+
* Provides width data for the 14 standard PDF fonts (Helvetica, Times, Courier families).
|
|
5
|
+
* Used for text measurement without requiring actual font files.
|
|
6
|
+
*
|
|
7
|
+
* Character widths are specified in 1/1000 of a text unit. To get the actual width
|
|
8
|
+
* of a character at a given font size:
|
|
9
|
+
* width_in_points = (charWidth / 1000) * fontSize
|
|
10
|
+
*
|
|
11
|
+
* @see PDF Reference 1.7, Appendix D - Standard Type 1 Fonts
|
|
12
|
+
* @see Adobe Font Metrics files (AFM) for canonical widths
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Get the width of a character in a given font.
|
|
16
|
+
* @param charCode - Unicode code point (or char code)
|
|
17
|
+
* @param fontName - PDF standard font name
|
|
18
|
+
* @returns Width in thousandths of a unit
|
|
19
|
+
*/
|
|
20
|
+
export declare function getCharWidth(charCode: number, fontName: string): number;
|
|
21
|
+
/**
|
|
22
|
+
* Measure the width of a text string in the given font and size.
|
|
23
|
+
* @param text - The string to measure
|
|
24
|
+
* @param fontName - PDF standard font name
|
|
25
|
+
* @param fontSize - Font size in points
|
|
26
|
+
* @returns Width in points
|
|
27
|
+
*/
|
|
28
|
+
export declare function measureTextWidth(text: string, fontName: string, fontSize: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* Get the font ascent for a given font and size.
|
|
31
|
+
* @param fontName - PDF standard font name
|
|
32
|
+
* @param fontSize - Font size in points
|
|
33
|
+
* @returns Ascent in points (positive, distance above baseline)
|
|
34
|
+
*/
|
|
35
|
+
export declare function getFontAscent(fontName: string, fontSize: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Get the font descent for a given font and size.
|
|
38
|
+
* @param fontName - PDF standard font name
|
|
39
|
+
* @param fontSize - Font size in points
|
|
40
|
+
* @returns Descent in points (positive value representing distance below baseline)
|
|
41
|
+
*/
|
|
42
|
+
export declare function getFontDescent(fontName: string, fontSize: number): number;
|
|
43
|
+
/**
|
|
44
|
+
* Get the total line height (ascent - descent) for a font.
|
|
45
|
+
* @param fontName - PDF standard font name
|
|
46
|
+
* @param fontSize - Font size in points
|
|
47
|
+
* @returns Line height in points
|
|
48
|
+
*/
|
|
49
|
+
export declare function getLineHeight(fontName: string, fontSize: number): number;
|
|
50
|
+
/**
|
|
51
|
+
* Check if a font name is a known standard PDF font.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isStandardFont(fontName: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Get all supported standard font names.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getStandardFontNames(): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Map common font names (like "Arial", "Calibri") to closest standard font.
|
|
60
|
+
* Returns the input unchanged if it's already a standard font name.
|
|
61
|
+
* Falls back to "Helvetica" for unknown fonts.
|
|
62
|
+
*/
|
|
63
|
+
export declare function mapToStandardFont(fontName: string): string;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Font Metrics — shared between Word layout and PDF rendering.
|
|
3
|
+
*
|
|
4
|
+
* Provides width data for the 14 standard PDF fonts (Helvetica, Times, Courier families).
|
|
5
|
+
* Used for text measurement without requiring actual font files.
|
|
6
|
+
*
|
|
7
|
+
* Character widths are specified in 1/1000 of a text unit. To get the actual width
|
|
8
|
+
* of a character at a given font size:
|
|
9
|
+
* width_in_points = (charWidth / 1000) * fontSize
|
|
10
|
+
*
|
|
11
|
+
* @see PDF Reference 1.7, Appendix D - Standard Type 1 Fonts
|
|
12
|
+
* @see Adobe Font Metrics files (AFM) for canonical widths
|
|
13
|
+
*/
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// Helvetica Metrics (afm data: Helvetica)
|
|
16
|
+
// =============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Character widths for ASCII 32-126.
|
|
19
|
+
* Values are in thousandths of a unit of text space.
|
|
20
|
+
*/
|
|
21
|
+
// prettier-ignore
|
|
22
|
+
const HELVETICA_WIDTHS = {
|
|
23
|
+
32: 278, 33: 278, 34: 355, 35: 556, 36: 556, 37: 889, 38: 667, 39: 191, 40: 333, 41: 333,
|
|
24
|
+
42: 389, 43: 584, 44: 278, 45: 333, 46: 278, 47: 278, 48: 556, 49: 556, 50: 556, 51: 556,
|
|
25
|
+
52: 556, 53: 556, 54: 556, 55: 556, 56: 556, 57: 556, 58: 278, 59: 278, 60: 584, 61: 584,
|
|
26
|
+
62: 584, 63: 556, 64: 1015, 65: 667, 66: 667, 67: 722, 68: 722, 69: 667, 70: 611, 71: 778,
|
|
27
|
+
72: 722, 73: 278, 74: 500, 75: 667, 76: 556, 77: 833, 78: 722, 79: 778, 80: 667, 81: 778,
|
|
28
|
+
82: 722, 83: 667, 84: 611, 85: 722, 86: 667, 87: 944, 88: 667, 89: 667, 90: 611, 91: 278,
|
|
29
|
+
92: 278, 93: 278, 94: 469, 95: 556, 96: 333, 97: 556, 98: 556, 99: 500, 100: 556, 101: 556,
|
|
30
|
+
102: 278, 103: 556, 104: 556, 105: 222, 106: 222, 107: 500, 108: 222, 109: 833, 110: 556,
|
|
31
|
+
111: 556, 112: 556, 113: 556, 114: 333, 115: 500, 116: 278, 117: 556, 118: 500, 119: 722,
|
|
32
|
+
120: 500, 121: 500, 122: 500, 123: 334, 124: 260, 125: 334, 126: 584
|
|
33
|
+
};
|
|
34
|
+
// prettier-ignore
|
|
35
|
+
const HELVETICA_BOLD_WIDTHS = {
|
|
36
|
+
32: 278, 33: 333, 34: 474, 35: 556, 36: 556, 37: 889, 38: 722, 39: 238, 40: 333, 41: 333,
|
|
37
|
+
42: 389, 43: 584, 44: 278, 45: 333, 46: 278, 47: 278, 48: 556, 49: 556, 50: 556, 51: 556,
|
|
38
|
+
52: 556, 53: 556, 54: 556, 55: 556, 56: 556, 57: 556, 58: 333, 59: 333, 60: 584, 61: 584,
|
|
39
|
+
62: 584, 63: 611, 64: 975, 65: 722, 66: 722, 67: 722, 68: 722, 69: 667, 70: 611, 71: 778,
|
|
40
|
+
72: 722, 73: 278, 74: 556, 75: 722, 76: 611, 77: 833, 78: 722, 79: 778, 80: 667, 81: 778,
|
|
41
|
+
82: 722, 83: 667, 84: 611, 85: 722, 86: 667, 87: 944, 88: 667, 89: 667, 90: 611, 91: 333,
|
|
42
|
+
92: 278, 93: 333, 94: 584, 95: 556, 96: 333, 97: 556, 98: 611, 99: 556, 100: 611, 101: 556,
|
|
43
|
+
102: 333, 103: 611, 104: 611, 105: 278, 106: 278, 107: 556, 108: 278, 109: 889, 110: 611,
|
|
44
|
+
111: 611, 112: 611, 113: 611, 114: 389, 115: 556, 116: 333, 117: 611, 118: 556, 119: 778,
|
|
45
|
+
120: 556, 121: 556, 122: 500, 123: 389, 124: 280, 125: 389, 126: 584
|
|
46
|
+
};
|
|
47
|
+
// prettier-ignore
|
|
48
|
+
const TIMES_ROMAN_WIDTHS = {
|
|
49
|
+
32: 250, 33: 333, 34: 408, 35: 500, 36: 500, 37: 833, 38: 778, 39: 180, 40: 333, 41: 333,
|
|
50
|
+
42: 500, 43: 564, 44: 250, 45: 333, 46: 250, 47: 278, 48: 500, 49: 500, 50: 500, 51: 500,
|
|
51
|
+
52: 500, 53: 500, 54: 500, 55: 500, 56: 500, 57: 500, 58: 278, 59: 278, 60: 564, 61: 564,
|
|
52
|
+
62: 564, 63: 444, 64: 921, 65: 722, 66: 667, 67: 667, 68: 722, 69: 611, 70: 556, 71: 722,
|
|
53
|
+
72: 722, 73: 333, 74: 389, 75: 722, 76: 611, 77: 889, 78: 722, 79: 722, 80: 556, 81: 722,
|
|
54
|
+
82: 667, 83: 556, 84: 611, 85: 722, 86: 722, 87: 944, 88: 722, 89: 722, 90: 611, 91: 333,
|
|
55
|
+
92: 278, 93: 333, 94: 469, 95: 500, 96: 333, 97: 444, 98: 500, 99: 444, 100: 500, 101: 444,
|
|
56
|
+
102: 333, 103: 500, 104: 500, 105: 278, 106: 278, 107: 500, 108: 278, 109: 778, 110: 500,
|
|
57
|
+
111: 500, 112: 500, 113: 500, 114: 333, 115: 389, 116: 278, 117: 500, 118: 500, 119: 722,
|
|
58
|
+
120: 500, 121: 500, 122: 444, 123: 480, 124: 200, 125: 480, 126: 541
|
|
59
|
+
};
|
|
60
|
+
// prettier-ignore
|
|
61
|
+
const TIMES_BOLD_WIDTHS = {
|
|
62
|
+
32: 250, 33: 333, 34: 555, 35: 500, 36: 500, 37: 1000, 38: 833, 39: 278, 40: 333, 41: 333,
|
|
63
|
+
42: 500, 43: 570, 44: 250, 45: 333, 46: 250, 47: 278, 48: 500, 49: 500, 50: 500, 51: 500,
|
|
64
|
+
52: 500, 53: 500, 54: 500, 55: 500, 56: 500, 57: 500, 58: 333, 59: 333, 60: 570, 61: 570,
|
|
65
|
+
62: 570, 63: 500, 64: 930, 65: 722, 66: 667, 67: 722, 68: 722, 69: 667, 70: 611, 71: 778,
|
|
66
|
+
72: 778, 73: 389, 74: 500, 75: 778, 76: 667, 77: 944, 78: 722, 79: 778, 80: 611, 81: 778,
|
|
67
|
+
82: 722, 83: 556, 84: 667, 85: 722, 86: 722, 87: 1000, 88: 722, 89: 722, 90: 667, 91: 333,
|
|
68
|
+
92: 278, 93: 333, 94: 581, 95: 500, 96: 333, 97: 500, 98: 556, 99: 444, 100: 556, 101: 444,
|
|
69
|
+
102: 333, 103: 500, 104: 556, 105: 278, 106: 333, 107: 556, 108: 278, 109: 833, 110: 556,
|
|
70
|
+
111: 500, 112: 556, 113: 556, 114: 444, 115: 389, 116: 333, 117: 556, 118: 500, 119: 722,
|
|
71
|
+
120: 500, 121: 500, 122: 444, 123: 394, 124: 220, 125: 394, 126: 520
|
|
72
|
+
};
|
|
73
|
+
// Courier is monospaced - every character is 600 units wide
|
|
74
|
+
const COURIER_WIDTH = 600;
|
|
75
|
+
const FONT_DESCRIPTORS = {
|
|
76
|
+
Helvetica: {
|
|
77
|
+
ascent: 718,
|
|
78
|
+
descent: -207,
|
|
79
|
+
capHeight: 718,
|
|
80
|
+
avgWidth: 513,
|
|
81
|
+
widths: HELVETICA_WIDTHS
|
|
82
|
+
},
|
|
83
|
+
"Helvetica-Bold": {
|
|
84
|
+
ascent: 718,
|
|
85
|
+
descent: -207,
|
|
86
|
+
capHeight: 718,
|
|
87
|
+
avgWidth: 535,
|
|
88
|
+
widths: HELVETICA_BOLD_WIDTHS
|
|
89
|
+
},
|
|
90
|
+
"Helvetica-Oblique": {
|
|
91
|
+
ascent: 718,
|
|
92
|
+
descent: -207,
|
|
93
|
+
capHeight: 718,
|
|
94
|
+
avgWidth: 513,
|
|
95
|
+
widths: HELVETICA_WIDTHS // same widths as regular
|
|
96
|
+
},
|
|
97
|
+
"Helvetica-BoldOblique": {
|
|
98
|
+
ascent: 718,
|
|
99
|
+
descent: -207,
|
|
100
|
+
capHeight: 718,
|
|
101
|
+
avgWidth: 535,
|
|
102
|
+
widths: HELVETICA_BOLD_WIDTHS
|
|
103
|
+
},
|
|
104
|
+
"Times-Roman": {
|
|
105
|
+
ascent: 683,
|
|
106
|
+
descent: -217,
|
|
107
|
+
capHeight: 662,
|
|
108
|
+
avgWidth: 478,
|
|
109
|
+
widths: TIMES_ROMAN_WIDTHS
|
|
110
|
+
},
|
|
111
|
+
"Times-Bold": {
|
|
112
|
+
ascent: 683,
|
|
113
|
+
descent: -217,
|
|
114
|
+
capHeight: 676,
|
|
115
|
+
avgWidth: 505,
|
|
116
|
+
widths: TIMES_BOLD_WIDTHS
|
|
117
|
+
},
|
|
118
|
+
"Times-Italic": {
|
|
119
|
+
ascent: 683,
|
|
120
|
+
descent: -217,
|
|
121
|
+
capHeight: 653,
|
|
122
|
+
avgWidth: 478,
|
|
123
|
+
widths: TIMES_ROMAN_WIDTHS // approximate
|
|
124
|
+
},
|
|
125
|
+
"Times-BoldItalic": {
|
|
126
|
+
ascent: 683,
|
|
127
|
+
descent: -217,
|
|
128
|
+
capHeight: 669,
|
|
129
|
+
avgWidth: 505,
|
|
130
|
+
widths: TIMES_BOLD_WIDTHS // approximate
|
|
131
|
+
},
|
|
132
|
+
Courier: {
|
|
133
|
+
ascent: 629,
|
|
134
|
+
descent: -157,
|
|
135
|
+
capHeight: 562,
|
|
136
|
+
avgWidth: 600,
|
|
137
|
+
widths: null,
|
|
138
|
+
monoWidth: COURIER_WIDTH
|
|
139
|
+
},
|
|
140
|
+
"Courier-Bold": {
|
|
141
|
+
ascent: 629,
|
|
142
|
+
descent: -157,
|
|
143
|
+
capHeight: 562,
|
|
144
|
+
avgWidth: 600,
|
|
145
|
+
widths: null,
|
|
146
|
+
monoWidth: COURIER_WIDTH
|
|
147
|
+
},
|
|
148
|
+
"Courier-Oblique": {
|
|
149
|
+
ascent: 629,
|
|
150
|
+
descent: -157,
|
|
151
|
+
capHeight: 562,
|
|
152
|
+
avgWidth: 600,
|
|
153
|
+
widths: null,
|
|
154
|
+
monoWidth: COURIER_WIDTH
|
|
155
|
+
},
|
|
156
|
+
"Courier-BoldOblique": {
|
|
157
|
+
ascent: 629,
|
|
158
|
+
descent: -157,
|
|
159
|
+
capHeight: 562,
|
|
160
|
+
avgWidth: 600,
|
|
161
|
+
widths: null,
|
|
162
|
+
monoWidth: COURIER_WIDTH
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
// =============================================================================
|
|
166
|
+
// Font Name Mapping
|
|
167
|
+
// =============================================================================
|
|
168
|
+
/**
|
|
169
|
+
* Maps common font family names to the closest standard PDF font.
|
|
170
|
+
*/
|
|
171
|
+
const FONT_FAMILY_MAP = {
|
|
172
|
+
// Sans-serif → Helvetica
|
|
173
|
+
helvetica: "Helvetica",
|
|
174
|
+
arial: "Helvetica",
|
|
175
|
+
calibri: "Helvetica",
|
|
176
|
+
"segoe ui": "Helvetica",
|
|
177
|
+
"trebuchet ms": "Helvetica",
|
|
178
|
+
verdana: "Helvetica",
|
|
179
|
+
tahoma: "Helvetica",
|
|
180
|
+
"gill sans": "Helvetica",
|
|
181
|
+
"franklin gothic": "Helvetica",
|
|
182
|
+
"lucida sans": "Helvetica",
|
|
183
|
+
aptos: "Helvetica",
|
|
184
|
+
// Serif → Times-Roman
|
|
185
|
+
"times new roman": "Times-Roman",
|
|
186
|
+
times: "Times-Roman",
|
|
187
|
+
georgia: "Times-Roman",
|
|
188
|
+
garamond: "Times-Roman",
|
|
189
|
+
"book antiqua": "Times-Roman",
|
|
190
|
+
palatino: "Times-Roman",
|
|
191
|
+
"palatino linotype": "Times-Roman",
|
|
192
|
+
cambria: "Times-Roman",
|
|
193
|
+
"century schoolbook": "Times-Roman",
|
|
194
|
+
// Monospace → Courier
|
|
195
|
+
"courier new": "Courier",
|
|
196
|
+
courier: "Courier",
|
|
197
|
+
consolas: "Courier",
|
|
198
|
+
"lucida console": "Courier",
|
|
199
|
+
monaco: "Courier",
|
|
200
|
+
"andale mono": "Courier",
|
|
201
|
+
"cascadia code": "Courier",
|
|
202
|
+
"cascadia mono": "Courier",
|
|
203
|
+
menlo: "Courier"
|
|
204
|
+
};
|
|
205
|
+
// =============================================================================
|
|
206
|
+
// Public API
|
|
207
|
+
// =============================================================================
|
|
208
|
+
/**
|
|
209
|
+
* Get the width of a character in a given font.
|
|
210
|
+
* @param charCode - Unicode code point (or char code)
|
|
211
|
+
* @param fontName - PDF standard font name
|
|
212
|
+
* @returns Width in thousandths of a unit
|
|
213
|
+
*/
|
|
214
|
+
export function getCharWidth(charCode, fontName) {
|
|
215
|
+
const desc = FONT_DESCRIPTORS[fontName];
|
|
216
|
+
if (!desc) {
|
|
217
|
+
// Fall back to Helvetica
|
|
218
|
+
return getCharWidth(charCode, "Helvetica");
|
|
219
|
+
}
|
|
220
|
+
if (desc.monoWidth !== undefined) {
|
|
221
|
+
return desc.monoWidth;
|
|
222
|
+
}
|
|
223
|
+
return desc.widths?.[charCode] ?? desc.avgWidth;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Measure the width of a text string in the given font and size.
|
|
227
|
+
* @param text - The string to measure
|
|
228
|
+
* @param fontName - PDF standard font name
|
|
229
|
+
* @param fontSize - Font size in points
|
|
230
|
+
* @returns Width in points
|
|
231
|
+
*/
|
|
232
|
+
export function measureTextWidth(text, fontName, fontSize) {
|
|
233
|
+
let totalWidth = 0;
|
|
234
|
+
for (let i = 0; i < text.length; i++) {
|
|
235
|
+
totalWidth += getCharWidth(text.charCodeAt(i), fontName);
|
|
236
|
+
}
|
|
237
|
+
return (totalWidth / 1000) * fontSize;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get the font ascent for a given font and size.
|
|
241
|
+
* @param fontName - PDF standard font name
|
|
242
|
+
* @param fontSize - Font size in points
|
|
243
|
+
* @returns Ascent in points (positive, distance above baseline)
|
|
244
|
+
*/
|
|
245
|
+
export function getFontAscent(fontName, fontSize) {
|
|
246
|
+
const desc = FONT_DESCRIPTORS[fontName] ?? FONT_DESCRIPTORS["Helvetica"];
|
|
247
|
+
return (desc.ascent / 1000) * fontSize;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get the font descent for a given font and size.
|
|
251
|
+
* @param fontName - PDF standard font name
|
|
252
|
+
* @param fontSize - Font size in points
|
|
253
|
+
* @returns Descent in points (positive value representing distance below baseline)
|
|
254
|
+
*/
|
|
255
|
+
export function getFontDescent(fontName, fontSize) {
|
|
256
|
+
const desc = FONT_DESCRIPTORS[fontName] ?? FONT_DESCRIPTORS["Helvetica"];
|
|
257
|
+
return (desc.descent / 1000) * fontSize;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get the total line height (ascent - descent) for a font.
|
|
261
|
+
* @param fontName - PDF standard font name
|
|
262
|
+
* @param fontSize - Font size in points
|
|
263
|
+
* @returns Line height in points
|
|
264
|
+
*/
|
|
265
|
+
export function getLineHeight(fontName, fontSize) {
|
|
266
|
+
const desc = FONT_DESCRIPTORS[fontName] ?? FONT_DESCRIPTORS["Helvetica"];
|
|
267
|
+
return ((desc.ascent - desc.descent) / 1000) * fontSize;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Check if a font name is a known standard PDF font.
|
|
271
|
+
*/
|
|
272
|
+
export function isStandardFont(fontName) {
|
|
273
|
+
return fontName in FONT_DESCRIPTORS;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Get all supported standard font names.
|
|
277
|
+
*/
|
|
278
|
+
export function getStandardFontNames() {
|
|
279
|
+
return Object.keys(FONT_DESCRIPTORS);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Map common font names (like "Arial", "Calibri") to closest standard font.
|
|
283
|
+
* Returns the input unchanged if it's already a standard font name.
|
|
284
|
+
* Falls back to "Helvetica" for unknown fonts.
|
|
285
|
+
*/
|
|
286
|
+
export function mapToStandardFont(fontName) {
|
|
287
|
+
// If it's already a standard font, return as-is
|
|
288
|
+
if (fontName in FONT_DESCRIPTORS) {
|
|
289
|
+
return fontName;
|
|
290
|
+
}
|
|
291
|
+
const lower = fontName.toLowerCase().trim();
|
|
292
|
+
return FONT_FAMILY_MAP[lower] ?? "Helvetica";
|
|
293
|
+
}
|