reamkit 1.27.0 → 1.29.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.
- package/README.md +6 -5
- package/dist/esm/core/converter/ream.d.ts +8 -9
- package/dist/esm/core/converter/ream.js +0 -1
- package/dist/esm/core/document-model/types.d.ts +5 -3
- package/dist/esm/core/font/index.d.ts +1 -0
- package/dist/esm/core/font/ligatures.d.ts +17 -0
- package/dist/esm/core/font/ligatures.js +49 -0
- package/dist/esm/core/font/ttf-parser.d.ts +2 -1
- package/dist/esm/core/font/ttf-parser.js +11 -2
- package/dist/esm/core/fonts/remote-fonts.d.ts +1 -1
- package/dist/esm/core/fonts/remote-fonts.js +47 -2
- package/dist/esm/core/fonts/scripts.js +10 -5
- package/dist/esm/excel/header-footer.js +53 -8
- package/dist/esm/layout/styled-layout.js +53 -3
- package/dist/esm/pdf/cid-font.js +35 -8
- package/dist/esm/pdf-reader/annot-draw.js +114 -1
- package/dist/esm/pdf-reader/annots.d.ts +0 -14
- package/dist/esm/pdf-reader/annots.js +13 -1
- package/dist/esm/pdf-reader/ccitt.d.ts +2 -3
- package/dist/esm/pdf-reader/ccitt.js +32 -4
- package/dist/esm/pdf-reader/cff-outline.d.ts +36 -0
- package/dist/esm/pdf-reader/cff-outline.js +1122 -0
- package/dist/esm/pdf-reader/cmap.js +16 -6
- package/dist/esm/pdf-reader/content.d.ts +91 -0
- package/dist/esm/pdf-reader/content.js +156 -60
- package/dist/esm/pdf-reader/dingbats.d.ts +11 -0
- package/dist/esm/pdf-reader/dingbats.js +1033 -0
- package/dist/esm/pdf-reader/display.js +41 -1
- package/dist/esm/pdf-reader/document.d.ts +8 -0
- package/dist/esm/pdf-reader/document.js +26 -9
- package/dist/esm/pdf-reader/embedded-fonts.d.ts +11 -0
- package/dist/esm/pdf-reader/embedded-fonts.js +14 -1
- package/dist/esm/pdf-reader/encodings.d.ts +25 -0
- package/dist/esm/pdf-reader/encodings.js +110 -0
- package/dist/esm/pdf-reader/flow-build.d.ts +15 -4
- package/dist/esm/pdf-reader/flow-build.js +24 -11
- package/dist/esm/pdf-reader/font.js +329 -8
- package/dist/esm/pdf-reader/glyf-outline.d.ts +43 -0
- package/dist/esm/pdf-reader/glyf-outline.js +351 -0
- package/dist/esm/pdf-reader/glyph-names.js +20 -0
- package/dist/esm/pdf-reader/icc.d.ts +10 -0
- package/dist/esm/pdf-reader/icc.js +210 -0
- package/dist/esm/pdf-reader/image-decode.d.ts +4 -3
- package/dist/esm/pdf-reader/image-decode.js +85 -64
- package/dist/esm/pdf-reader/images.d.ts +6 -0
- package/dist/esm/pdf-reader/images.js +50 -7
- package/dist/esm/pdf-reader/jbig2.js +104 -19
- package/dist/esm/pdf-reader/layout.js +1531 -55
- package/dist/esm/pdf-reader/math-rows.d.ts +23 -0
- package/dist/esm/pdf-reader/math-rows.js +198 -0
- package/dist/esm/pdf-reader/predefined-cmap.d.ts +21 -0
- package/dist/esm/pdf-reader/predefined-cmap.js +102 -0
- package/dist/esm/pdf-reader/reader.d.ts +6 -9
- package/dist/esm/pdf-reader/reader.js +34 -21
- package/dist/esm/pdf-reader/shading.d.ts +81 -2
- package/dist/esm/pdf-reader/shading.js +191 -25
- package/dist/esm/pdf-reader/stream-filters.d.ts +6 -0
- package/dist/esm/pdf-reader/stream-filters.js +67 -0
- package/dist/esm/pdf-reader/tagged.js +1 -1
- package/dist/esm/pdf-reader/text-rules.js +83 -10
- package/dist/esm/pdf-reader/text.js +82 -3
- package/dist/esm/pdf-reader/type1-outline.d.ts +21 -0
- package/dist/esm/pdf-reader/type1-outline.js +576 -0
- package/dist/esm/pdf-reader/vector.d.ts +2 -0
- package/dist/esm/pdf-reader/vector.js +44 -4
- package/dist/esm/word/document-parser.js +4 -1
- package/dist/esm/word/docx-writer.js +28 -11
- package/package.json +1 -1
|
@@ -482,7 +482,7 @@ function chartBlockXml(chart, state, scope, losses) {
|
|
|
482
482
|
const cx = Math.round(chart.width * EMU_PER_PT);
|
|
483
483
|
const cy = Math.round(chart.height * EMU_PER_PT);
|
|
484
484
|
const id = ++state.drawingSeq;
|
|
485
|
-
return `<w:drawing><wp:inline xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"><wp:extent cx="${cx}" cy="${cy}"/><wp:docPr id="${id}" name="Chart ${id}"${chart.altText ? ` descr="${escapeAttr(chart.altText)}"` : ""}/><a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart"><c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="${relId}"/></a:graphicData></a:graphic></wp:inline></w:drawing>`;
|
|
485
|
+
return `<w:drawing><wp:inline xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${cx}" cy="${cy}"/><wp:docPr id="${id}" name="Chart ${id}"${chart.altText ? ` descr="${escapeAttr(chart.altText)}"` : ""}/><a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart"><c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="${relId}"/></a:graphicData></a:graphic></wp:inline></w:drawing>`;
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
488
488
|
* §20.4.2.3 — the frame a drawing is placed by: `wp:anchor` where the block
|
|
@@ -510,7 +510,7 @@ function chartBlockXml(chart, state, scope, losses) {
|
|
|
510
510
|
*/
|
|
511
511
|
function drawingFrame(float, cx, cy, head, graphic, state, rotation60k) {
|
|
512
512
|
const WP_NS = " xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\"";
|
|
513
|
-
if (!float) return `<w:drawing><wp:inline${WP_NS}><wp:extent cx="${cx}" cy="${cy}"/>${head}${graphic}</wp:inline></w:drawing>`;
|
|
513
|
+
if (!float) return `<w:drawing><wp:inline${WP_NS} distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${cx}" cy="${cy}"/>${head}${graphic}</wp:inline></w:drawing>`;
|
|
514
514
|
const emu = (pt) => Number.isFinite(pt) ? Math.round((pt ?? 0) * EMU_PER_PT) : 0;
|
|
515
515
|
const d = float.wrapDist;
|
|
516
516
|
const dist = ` distT="${String(emu(d?.topPt))}" distB="${String(emu(d?.bottomPt))}" distL="${String(emu(d?.leftPt))}" distR="${String(emu(d?.rightPt))}"`;
|
|
@@ -821,22 +821,27 @@ function runXml(run, state, scope) {
|
|
|
821
821
|
if (run.noteNumber) return `<w:r>${rPr}<${scope.noteKind === "endnote" ? "w:endnoteRef" : "w:footnoteRef"}/></w:r>`;
|
|
822
822
|
if (run.commentRef !== void 0) return `<w:r>${rPr}<w:commentReference w:id="${escapeAttr(run.commentRef)}"/></w:r>`;
|
|
823
823
|
const brk = run.pageBreak ? "<w:br w:type=\"page\"/>" : "";
|
|
824
|
+
if (run.field !== void 0 && run.text !== "") {
|
|
825
|
+
const inner = `<w:r>${rPr}<w:t xml:space="preserve">${escapeXml(run.text)}</w:t></w:r>`;
|
|
826
|
+
return `<w:fldSimple w:instr=" ${run.field} ">${inner}</w:fldSimple>${brk}`;
|
|
827
|
+
}
|
|
824
828
|
if (run.text === "") return brk ? `<w:r>${rPr}${brk}</w:r>` : "";
|
|
825
|
-
return `<w:r>${rPr}
|
|
829
|
+
return `<w:r>${rPr}${run.text.split(" ").map((piece) => piece === "" ? "" : `<w:t xml:space="preserve">${escapeXml(piece)}</w:t>`).join("<w:tab/>")}${brk}</w:r>`;
|
|
826
830
|
}
|
|
827
831
|
function rPrXml(r) {
|
|
828
832
|
const out = [];
|
|
833
|
+
const states = (key) => r[key] !== void 0 && r[key] !== DEFAULT_RUN[key];
|
|
829
834
|
const fonts = rFontsXml(r.fontFamily);
|
|
830
835
|
if (fonts) out.push(fonts);
|
|
831
|
-
if (
|
|
832
|
-
if (
|
|
833
|
-
if (
|
|
834
|
-
if (
|
|
835
|
-
if (
|
|
836
|
-
if (
|
|
836
|
+
if (states("bold")) out.push(toggle("w:b", r.bold));
|
|
837
|
+
if (states("italic")) out.push(toggle("w:i", r.italic));
|
|
838
|
+
if (states("strike")) out.push(toggle("w:strike", r.strike));
|
|
839
|
+
if (states("colorHex")) out.push(`<w:color w:val="${r.colorHex}"/>`);
|
|
840
|
+
if (states("fontSizePt")) out.push(`<w:sz w:val="${Math.round(r.fontSizePt * 2)}"/>`);
|
|
841
|
+
if (states("underline")) out.push(underlineXml(r));
|
|
837
842
|
if (r.shadingColorHex !== void 0) out.push(runShdXml(r.shadingColorHex));
|
|
838
|
-
if (
|
|
839
|
-
if (
|
|
843
|
+
if (states("verticalAlign")) out.push(`<w:vertAlign w:val="${r.verticalAlign}"/>`);
|
|
844
|
+
if (states("rtl")) out.push(toggle("w:rtl", r.rtl));
|
|
840
845
|
if (r.lang !== void 0) out.push(`<w:lang w:val="${escapeAttr(r.lang)}"/>`);
|
|
841
846
|
return out.length > 0 ? `<w:rPr>${out.join("")}</w:rPr>` : "";
|
|
842
847
|
}
|
|
@@ -858,6 +863,17 @@ function pPrBody(p) {
|
|
|
858
863
|
const spacing = spacingXml(p);
|
|
859
864
|
if (spacing) out.push(spacing);
|
|
860
865
|
if (JC.has(p.alignment) && p.alignment !== DEFAULT_PARA.alignment) out.push(`<w:jc w:val="${p.alignment}"/>`);
|
|
866
|
+
const pBdr = bordersXml("w:pBdr", p.borders);
|
|
867
|
+
if (pBdr) out.push(pBdr);
|
|
868
|
+
const tabs = p.tabs ?? [];
|
|
869
|
+
if (tabs.length > 0) {
|
|
870
|
+
const stops = tabs.map((t) => {
|
|
871
|
+
const pos = twips(t.positionPt);
|
|
872
|
+
const leader = t.leader !== void 0 ? ` w:leader="${escapeAttr(t.leader)}"` : "";
|
|
873
|
+
return `<w:tab w:val="${escapeAttr(t.alignment ?? "left")}" w:pos="${String(pos)}"${leader}/>`;
|
|
874
|
+
}).join("");
|
|
875
|
+
out.push(`<w:tabs>${stops}</w:tabs>`);
|
|
876
|
+
}
|
|
861
877
|
return out.join("");
|
|
862
878
|
}
|
|
863
879
|
function pPrWithSect(p, closingSectPr) {
|
|
@@ -976,6 +992,7 @@ function sectPrXml(s, hf) {
|
|
|
976
992
|
const parts = [];
|
|
977
993
|
for (const h of hf.headers) parts.push(`<w:headerReference w:type="${h.type}" r:id="${h.relId}"/>`);
|
|
978
994
|
for (const f of hf.footers) parts.push(`<w:footerReference w:type="${f.type}" r:id="${f.relId}"/>`);
|
|
995
|
+
if (s.sectionStart !== void 0 && s.sectionStart !== "nextPage") parts.push(`<w:type w:val="${s.sectionStart}"/>`);
|
|
979
996
|
if (s.pageSize) {
|
|
980
997
|
const orient = s.pageSize.orientation === "landscape" ? " w:orient=\"landscape\"" : "";
|
|
981
998
|
parts.push(`<w:pgSz w:w="${twips(s.pageSize.width)}" w:h="${twips(s.pageSize.height)}"${orient}/>`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reamkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "Ream — convert DOCX, XLSX, PPTX and PDF to PDF, SVG, HTML, DOCX and XLSX, built from scratch on the ECMA-376 and ISO 32000 specifications. Parse once, convert anywhere.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alex Krassavin <info@reamkit.dev>",
|