abstract-document 6.6.0 → 6.7.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/CHANGELOG.md +7 -1
- package/lib/abstract-document/styles/text-style.d.ts +3 -0
- package/lib/abstract-document/styles/text-style.d.ts.map +1 -1
- package/lib/abstract-document/styles/text-style.js +2 -1
- package/lib/abstract-document/styles/text-style.js.map +1 -1
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-alphabetic.d.ts +3 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-alphabetic.d.ts.map +1 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-alphabetic.js +65 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-alphabetic.js.map +1 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-bottom.d.ts +3 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-bottom.d.ts.map +1 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-bottom.js +65 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-bottom.js.map +1 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-hanging.d.ts +3 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-hanging.d.ts.map +1 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-hanging.js +65 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-hanging.js.map +1 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-middle.d.ts +3 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-middle.d.ts.map +1 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-middle.js +65 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-middle.js.map +1 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-top.d.ts +3 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-top.d.ts.map +1 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-top.js +65 -0
- package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-top.js.map +1 -0
- package/lib/abstract-document-exporters/pdf/render.js +2 -2
- package/lib/abstract-document-exporters/pdf/render.js.map +1 -1
- package/package.json +2 -2
- package/src/abstract-document/styles/text-style.ts +4 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Group.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Header and footer.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Header → footer.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed hyperlink and textrun.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed hyperlink → textrun.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed textrun and images.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed textrun → images.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple images.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple tables.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Center alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with End alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment that linebreaks.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Page numbering.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table colSpan and rowSpan.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table colSpan → rowSpan.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table without rows.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single hyperlink.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single image.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment that linebreaks.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment that linebreaks.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment that linebreaks.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/hello.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/world.docx +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-alphabetic.tsx +46 -0
- package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-bottom.tsx +46 -0
- package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-hanging.tsx +46 -0
- package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-middle.tsx +46 -0
- package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-top.tsx +46 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position group.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position header and footer.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position paragraph.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in group.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in table.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position table.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Paragraphs.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Tables.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Group no keeptogether.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Group too big for one page.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Header and footer.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal linktarget.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Margins header body footer.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed textrun and images.pdf and b/package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed textrun → images.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images overflow.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Center alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with End alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment that linebreaks.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Page numbering.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table row that doesnt fit page.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table single row.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with group.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header 2.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin bottom.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top single table.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan multipages.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all auto.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all fix.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table background.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of image.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of text.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table center alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table colSpan and rowSpan.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table mix auto fix.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table padding.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table right alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table row alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell with wrapping.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with default colored borders.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with header.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with multi colored borders.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with single colored borders.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single date.pdf +14 -14
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single figure.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink centered.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink right aligned.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color hex.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color name.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color url.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline alphabetic.pdf +113 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline bottom.pdf +113 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline hanging.pdf +113 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline middle.pdf +113 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline top.pdf +113 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment that linebreaks.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment that linebreaks.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Justify alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment that linebreaks.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with super and subscripts.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Table of content separator.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/hello.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/world.pdf +2 -2
- package/src/abstract-document-exporters/pdf/render.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abstract-document",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "Dynamically create documents using code or JSX and render to any format",
|
|
5
5
|
"repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/abstract-document",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"jszip": "^3.7.1",
|
|
40
40
|
"pdf2json": "^1.2.3"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "98081a1566a9b59e3cac59bd1de9ad183a38cdf2"
|
|
43
43
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type TextAlignment = "left" | "center" | "right" | "justify";
|
|
2
|
+
export type TextBaseline = "top" | "bottom" | "middle" | "alphabetic" | "hanging";
|
|
2
3
|
|
|
3
4
|
export interface TextStyle {
|
|
4
5
|
readonly type: "TextStyle";
|
|
@@ -17,6 +18,7 @@ export interface TextStyle {
|
|
|
17
18
|
readonly lineGap?: number;
|
|
18
19
|
readonly lineBreak?: boolean;
|
|
19
20
|
readonly alignment?: TextAlignment;
|
|
21
|
+
readonly baseline?: TextBaseline;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export interface TextStyleProps {
|
|
@@ -35,6 +37,7 @@ export interface TextStyleProps {
|
|
|
35
37
|
readonly lineGap?: number;
|
|
36
38
|
readonly lineBreak?: boolean;
|
|
37
39
|
readonly alignment?: TextAlignment;
|
|
40
|
+
readonly baseline?: TextBaseline;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
export function create(props?: TextStyleProps): TextStyle {
|
|
@@ -63,6 +66,7 @@ export function overrideWith(overrider: TextStyle | undefined, toOverride: TextS
|
|
|
63
66
|
lineGap: a.lineGap || b.lineGap,
|
|
64
67
|
lineBreak: a.lineBreak ?? b.lineBreak,
|
|
65
68
|
alignment: a.alignment ?? b.alignment,
|
|
69
|
+
baseline: a.baseline ?? b.baseline,
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
72
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with End alignment.docx
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment.docx
CHANGED
|
Binary file
|
|
Binary file
|
package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment.docx
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ExportTestDef } from "../export-test-def";
|
|
3
|
+
import * as TextStyle from "../../../../abstract-document/styles/text-style";
|
|
4
|
+
import { Paragraph, AbstractDoc, Section, TextRun } from "../../../../abstract-document-jsx";
|
|
5
|
+
|
|
6
|
+
export const test: ExportTestDef = {
|
|
7
|
+
name: "Single textrun baseline alphabetic",
|
|
8
|
+
abstractDocJsx: (
|
|
9
|
+
<AbstractDoc>
|
|
10
|
+
<Section>
|
|
11
|
+
<Paragraph>
|
|
12
|
+
<TextRun style={TextStyle.create({ baseline: "alphabetic" })} text={"Hello"} />
|
|
13
|
+
</Paragraph>
|
|
14
|
+
</Section>
|
|
15
|
+
</AbstractDoc>
|
|
16
|
+
),
|
|
17
|
+
expectedPdfJson: {
|
|
18
|
+
formImage: {
|
|
19
|
+
Transcoder: "pdf2json@1.2.3 [https://github.com/modesty/pdf2json]",
|
|
20
|
+
Agency: "",
|
|
21
|
+
Id: { AgencyId: "", Name: "", MC: false, Max: 1, Parent: "" },
|
|
22
|
+
Pages: [
|
|
23
|
+
{
|
|
24
|
+
Height: 52.625,
|
|
25
|
+
HLines: [],
|
|
26
|
+
VLines: [],
|
|
27
|
+
Fills: [{ x: 0, y: 0, w: 0, h: 0, clr: 1 }],
|
|
28
|
+
Texts: [
|
|
29
|
+
{
|
|
30
|
+
x: -0.25,
|
|
31
|
+
y: -0.75,
|
|
32
|
+
w: 22.78,
|
|
33
|
+
sw: 0.32553125,
|
|
34
|
+
clr: 0,
|
|
35
|
+
A: "left",
|
|
36
|
+
R: [{ T: "Hello", S: -1, TS: [0, 13, 0, 0] }],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
Fields: [],
|
|
40
|
+
Boxsets: [],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
Width: 37.188,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-bottom.tsx
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ExportTestDef } from "../export-test-def";
|
|
3
|
+
import * as TextStyle from "../../../../abstract-document/styles/text-style";
|
|
4
|
+
import { Paragraph, AbstractDoc, Section, TextRun } from "../../../../abstract-document-jsx";
|
|
5
|
+
|
|
6
|
+
export const test: ExportTestDef = {
|
|
7
|
+
name: "Single textrun baseline bottom",
|
|
8
|
+
abstractDocJsx: (
|
|
9
|
+
<AbstractDoc>
|
|
10
|
+
<Section>
|
|
11
|
+
<Paragraph>
|
|
12
|
+
<TextRun style={TextStyle.create({ baseline: "bottom" })} text={"Hello"} />
|
|
13
|
+
</Paragraph>
|
|
14
|
+
</Section>
|
|
15
|
+
</AbstractDoc>
|
|
16
|
+
),
|
|
17
|
+
expectedPdfJson: {
|
|
18
|
+
formImage: {
|
|
19
|
+
Transcoder: "pdf2json@1.2.3 [https://github.com/modesty/pdf2json]",
|
|
20
|
+
Agency: "",
|
|
21
|
+
Id: { AgencyId: "", Name: "", MC: false, Max: 1, Parent: "" },
|
|
22
|
+
Pages: [
|
|
23
|
+
{
|
|
24
|
+
Height: 52.625,
|
|
25
|
+
HLines: [],
|
|
26
|
+
VLines: [],
|
|
27
|
+
Fills: [{ x: 0, y: 0, w: 0, h: 0, clr: 1 }],
|
|
28
|
+
Texts: [
|
|
29
|
+
{
|
|
30
|
+
x: -0.25,
|
|
31
|
+
y: -0.879,
|
|
32
|
+
w: 22.78,
|
|
33
|
+
sw: 0.32553125,
|
|
34
|
+
clr: 0,
|
|
35
|
+
A: "left",
|
|
36
|
+
R: [{ T: "Hello", S: -1, TS: [0, 13, 0, 0] }],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
Fields: [],
|
|
40
|
+
Boxsets: [],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
Width: 37.188,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-hanging.tsx
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ExportTestDef } from "../export-test-def";
|
|
3
|
+
import * as TextStyle from "../../../../abstract-document/styles/text-style";
|
|
4
|
+
import { Paragraph, AbstractDoc, Section, TextRun } from "../../../../abstract-document-jsx";
|
|
5
|
+
|
|
6
|
+
export const test: ExportTestDef = {
|
|
7
|
+
name: "Single textrun baseline hanging",
|
|
8
|
+
abstractDocJsx: (
|
|
9
|
+
<AbstractDoc>
|
|
10
|
+
<Section>
|
|
11
|
+
<Paragraph>
|
|
12
|
+
<TextRun style={TextStyle.create({ baseline: "hanging" })} text={"Hello"} />
|
|
13
|
+
</Paragraph>
|
|
14
|
+
</Section>
|
|
15
|
+
</AbstractDoc>
|
|
16
|
+
),
|
|
17
|
+
expectedPdfJson: {
|
|
18
|
+
formImage: {
|
|
19
|
+
Transcoder: "pdf2json@1.2.3 [https://github.com/modesty/pdf2json]",
|
|
20
|
+
Agency: "",
|
|
21
|
+
Id: { AgencyId: "", Name: "", MC: false, Max: 1, Parent: "" },
|
|
22
|
+
Pages: [
|
|
23
|
+
{
|
|
24
|
+
Height: 52.625,
|
|
25
|
+
HLines: [],
|
|
26
|
+
VLines: [],
|
|
27
|
+
Fills: [{ x: 0, y: 0, w: 0, h: 0, clr: 1 }],
|
|
28
|
+
Texts: [
|
|
29
|
+
{
|
|
30
|
+
x: -0.25,
|
|
31
|
+
y: -0.391,
|
|
32
|
+
w: 22.78,
|
|
33
|
+
sw: 0.32553125,
|
|
34
|
+
clr: 0,
|
|
35
|
+
A: "left",
|
|
36
|
+
R: [{ T: "Hello", S: -1, TS: [0, 13, 0, 0] }],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
Fields: [],
|
|
40
|
+
Boxsets: [],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
Width: 37.188,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-middle.tsx
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ExportTestDef } from "../export-test-def";
|
|
3
|
+
import * as TextStyle from "../../../../abstract-document/styles/text-style";
|
|
4
|
+
import { Paragraph, AbstractDoc, Section, TextRun } from "../../../../abstract-document-jsx";
|
|
5
|
+
|
|
6
|
+
export const test: ExportTestDef = {
|
|
7
|
+
name: "Single textrun baseline middle",
|
|
8
|
+
abstractDocJsx: (
|
|
9
|
+
<AbstractDoc>
|
|
10
|
+
<Section>
|
|
11
|
+
<Paragraph>
|
|
12
|
+
<TextRun style={TextStyle.create({ baseline: "middle" })} text={"Hello"} />
|
|
13
|
+
</Paragraph>
|
|
14
|
+
</Section>
|
|
15
|
+
</AbstractDoc>
|
|
16
|
+
),
|
|
17
|
+
expectedPdfJson: {
|
|
18
|
+
formImage: {
|
|
19
|
+
Transcoder: "pdf2json@1.2.3 [https://github.com/modesty/pdf2json]",
|
|
20
|
+
Agency: "",
|
|
21
|
+
Id: { AgencyId: "", Name: "", MC: false, Max: 1, Parent: "" },
|
|
22
|
+
Pages: [
|
|
23
|
+
{
|
|
24
|
+
Height: 52.625,
|
|
25
|
+
HLines: [],
|
|
26
|
+
VLines: [],
|
|
27
|
+
Fills: [{ x: 0, y: 0, w: 0, h: 0, clr: 1 }],
|
|
28
|
+
Texts: [
|
|
29
|
+
{
|
|
30
|
+
x: -0.25,
|
|
31
|
+
y: -0.59,
|
|
32
|
+
w: 22.78,
|
|
33
|
+
sw: 0.32553125,
|
|
34
|
+
clr: 0,
|
|
35
|
+
A: "left",
|
|
36
|
+
R: [{ T: "Hello", S: -1, TS: [0, 13, 0, 0] }],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
Fields: [],
|
|
40
|
+
Boxsets: [],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
Width: 37.188,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-textrun-baseline-top.tsx
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ExportTestDef } from "../export-test-def";
|
|
3
|
+
import * as TextStyle from "../../../../abstract-document/styles/text-style";
|
|
4
|
+
import { Paragraph, AbstractDoc, Section, TextRun } from "../../../../abstract-document-jsx";
|
|
5
|
+
|
|
6
|
+
export const test: ExportTestDef = {
|
|
7
|
+
name: "Single textrun baseline top",
|
|
8
|
+
abstractDocJsx: (
|
|
9
|
+
<AbstractDoc>
|
|
10
|
+
<Section>
|
|
11
|
+
<Paragraph>
|
|
12
|
+
<TextRun style={TextStyle.create({ baseline: "top" })} text={"Hello"} />
|
|
13
|
+
</Paragraph>
|
|
14
|
+
</Section>
|
|
15
|
+
</AbstractDoc>
|
|
16
|
+
),
|
|
17
|
+
expectedPdfJson: {
|
|
18
|
+
formImage: {
|
|
19
|
+
Transcoder: "pdf2json@1.2.3 [https://github.com/modesty/pdf2json]",
|
|
20
|
+
Agency: "",
|
|
21
|
+
Id: { AgencyId: "", Name: "", MC: false, Max: 1, Parent: "" },
|
|
22
|
+
Pages: [
|
|
23
|
+
{
|
|
24
|
+
Height: 52.625,
|
|
25
|
+
HLines: [],
|
|
26
|
+
VLines: [],
|
|
27
|
+
Fills: [{ x: 0, y: 0, w: 0, h: 0, clr: 1 }],
|
|
28
|
+
Texts: [
|
|
29
|
+
{
|
|
30
|
+
x: -0.25,
|
|
31
|
+
y: -0.301,
|
|
32
|
+
w: 22.78,
|
|
33
|
+
sw: 0.32553125,
|
|
34
|
+
clr: 0,
|
|
35
|
+
A: "left",
|
|
36
|
+
R: [{ T: "Hello", S: -1, TS: [0, 13, 0, 0] }],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
Fields: [],
|
|
40
|
+
Boxsets: [],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
Width: 37.188,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -53,7 +53,7 @@ endobj
|
|
|
53
53
|
(PDFKit)
|
|
54
54
|
endobj
|
|
55
55
|
12 0 obj
|
|
56
|
-
(D:
|
|
56
|
+
(D:20220215122940Z)
|
|
57
57
|
endobj
|
|
58
58
|
9 0 obj
|
|
59
59
|
<<
|
|
@@ -116,7 +116,7 @@ trailer
|
|
|
116
116
|
/Size 13
|
|
117
117
|
/Root 3 0 R
|
|
118
118
|
/Info 9 0 R
|
|
119
|
-
/ID [<
|
|
119
|
+
/ID [<2061a6d72c8e8abbf2bfb6def6a41064> <2061a6d72c8e8abbf2bfb6def6a41064>]
|
|
120
120
|
>>
|
|
121
121
|
startxref
|
|
122
122
|
1104
|
package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position header and footer.pdf
CHANGED
|
@@ -103,7 +103,7 @@ endobj
|
|
|
103
103
|
(PDFKit)
|
|
104
104
|
endobj
|
|
105
105
|
12 0 obj
|
|
106
|
-
(D:
|
|
106
|
+
(D:20220215122940Z)
|
|
107
107
|
endobj
|
|
108
108
|
9 0 obj
|
|
109
109
|
<<
|
|
@@ -166,7 +166,7 @@ trailer
|
|
|
166
166
|
/Size 13
|
|
167
167
|
/Root 3 0 R
|
|
168
168
|
/Info 9 0 R
|
|
169
|
-
/ID [<
|
|
169
|
+
/ID [<c7ee0e405fb995b1c2eda5ea9f8a966d> <c7ee0e405fb995b1c2eda5ea9f8a966d>]
|
|
170
170
|
>>
|
|
171
171
|
startxref
|
|
172
172
|
1492
|
|
@@ -43,7 +43,7 @@ endobj
|
|
|
43
43
|
(PDFKit)
|
|
44
44
|
endobj
|
|
45
45
|
12 0 obj
|
|
46
|
-
(D:
|
|
46
|
+
(D:20220215122941Z)
|
|
47
47
|
endobj
|
|
48
48
|
9 0 obj
|
|
49
49
|
<<
|
|
@@ -106,7 +106,7 @@ trailer
|
|
|
106
106
|
/Size 13
|
|
107
107
|
/Root 3 0 R
|
|
108
108
|
/Info 9 0 R
|
|
109
|
-
/ID [<
|
|
109
|
+
/ID [<df79a1961dd4c169746f0a1530941d94> <df79a1961dd4c169746f0a1530941d94>]
|
|
110
110
|
>>
|
|
111
111
|
startxref
|
|
112
112
|
902
|
package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in group.pdf
CHANGED
|
@@ -53,7 +53,7 @@ endobj
|
|
|
53
53
|
(PDFKit)
|
|
54
54
|
endobj
|
|
55
55
|
12 0 obj
|
|
56
|
-
(D:
|
|
56
|
+
(D:20220215122941Z)
|
|
57
57
|
endobj
|
|
58
58
|
9 0 obj
|
|
59
59
|
<<
|
|
@@ -116,7 +116,7 @@ trailer
|
|
|
116
116
|
/Size 13
|
|
117
117
|
/Root 3 0 R
|
|
118
118
|
/Info 9 0 R
|
|
119
|
-
/ID [<
|
|
119
|
+
/ID [<701979245bd67674b2fc0708a34e0b22> <701979245bd67674b2fc0708a34e0b22>]
|
|
120
120
|
>>
|
|
121
121
|
startxref
|
|
122
122
|
1066
|
package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in table.pdf
CHANGED
|
@@ -77,7 +77,7 @@ endobj
|
|
|
77
77
|
(PDFKit)
|
|
78
78
|
endobj
|
|
79
79
|
12 0 obj
|
|
80
|
-
(D:
|
|
80
|
+
(D:20220215122941Z)
|
|
81
81
|
endobj
|
|
82
82
|
9 0 obj
|
|
83
83
|
<<
|
|
@@ -140,7 +140,7 @@ trailer
|
|
|
140
140
|
/Size 13
|
|
141
141
|
/Root 3 0 R
|
|
142
142
|
/Info 9 0 R
|
|
143
|
-
/ID [<
|
|
143
|
+
/ID [<ae214075f700258bd813e21179d94af7> <ae214075f700258bd813e21179d94af7>]
|
|
144
144
|
>>
|
|
145
145
|
startxref
|
|
146
146
|
1373
|
|
@@ -67,7 +67,7 @@ endobj
|
|
|
67
67
|
(PDFKit)
|
|
68
68
|
endobj
|
|
69
69
|
12 0 obj
|
|
70
|
-
(D:
|
|
70
|
+
(D:20220215122941Z)
|
|
71
71
|
endobj
|
|
72
72
|
9 0 obj
|
|
73
73
|
<<
|
|
@@ -130,7 +130,7 @@ trailer
|
|
|
130
130
|
/Size 13
|
|
131
131
|
/Root 3 0 R
|
|
132
132
|
/Info 9 0 R
|
|
133
|
-
/ID [<
|
|
133
|
+
/ID [<ade3ce8de1165cd675c4ec353b9ec79e> <ade3ce8de1165cd675c4ec353b9ec79e>]
|
|
134
134
|
>>
|
|
135
135
|
startxref
|
|
136
136
|
1151
|
|
@@ -839,7 +839,7 @@ endobj
|
|
|
839
839
|
(PDFKit)
|
|
840
840
|
endobj
|
|
841
841
|
15 0 obj
|
|
842
|
-
(D:
|
|
842
|
+
(D:20220215122941Z)
|
|
843
843
|
endobj
|
|
844
844
|
12 0 obj
|
|
845
845
|
<<
|
|
@@ -905,7 +905,7 @@ trailer
|
|
|
905
905
|
/Size 16
|
|
906
906
|
/Root 3 0 R
|
|
907
907
|
/Info 12 0 R
|
|
908
|
-
/ID [<
|
|
908
|
+
/ID [<ad03bfab1c5dbaebd2ef57d43f5ef9ea> <ad03bfab1c5dbaebd2ef57d43f5ef9ea>]
|
|
909
909
|
>>
|
|
910
910
|
startxref
|
|
911
911
|
21921
|
|
@@ -859,7 +859,7 @@ endobj
|
|
|
859
859
|
(PDFKit)
|
|
860
860
|
endobj
|
|
861
861
|
15 0 obj
|
|
862
|
-
(D:
|
|
862
|
+
(D:20220215122941Z)
|
|
863
863
|
endobj
|
|
864
864
|
12 0 obj
|
|
865
865
|
<<
|
|
@@ -925,7 +925,7 @@ trailer
|
|
|
925
925
|
/Size 16
|
|
926
926
|
/Root 3 0 R
|
|
927
927
|
/Info 12 0 R
|
|
928
|
-
/ID [<
|
|
928
|
+
/ID [<7ab79be7315f6fb2908d15093c93a13d> <7ab79be7315f6fb2908d15093c93a13d>]
|
|
929
929
|
>>
|
|
930
930
|
startxref
|
|
931
931
|
9445
|
|
@@ -839,7 +839,7 @@ endobj
|
|
|
839
839
|
(PDFKit)
|
|
840
840
|
endobj
|
|
841
841
|
15 0 obj
|
|
842
|
-
(D:
|
|
842
|
+
(D:20220215122941Z)
|
|
843
843
|
endobj
|
|
844
844
|
12 0 obj
|
|
845
845
|
<<
|
|
@@ -905,7 +905,7 @@ trailer
|
|
|
905
905
|
/Size 16
|
|
906
906
|
/Root 3 0 R
|
|
907
907
|
/Info 12 0 R
|
|
908
|
-
/ID [<
|
|
908
|
+
/ID [<f9a28aea26ae1301ce3cb61b92777ff0> <f9a28aea26ae1301ce3cb61b92777ff0>]
|
|
909
909
|
>>
|
|
910
910
|
startxref
|
|
911
911
|
21915
|
|
@@ -195,7 +195,7 @@ endobj
|
|
|
195
195
|
(PDFKit)
|
|
196
196
|
endobj
|
|
197
197
|
15 0 obj
|
|
198
|
-
(D:
|
|
198
|
+
(D:20220215122941Z)
|
|
199
199
|
endobj
|
|
200
200
|
12 0 obj
|
|
201
201
|
<<
|
|
@@ -261,7 +261,7 @@ trailer
|
|
|
261
261
|
/Size 16
|
|
262
262
|
/Root 3 0 R
|
|
263
263
|
/Info 12 0 R
|
|
264
|
-
/ID [<
|
|
264
|
+
/ID [<85b072642fd6f65b6b2ea7429099d620> <85b072642fd6f65b6b2ea7429099d620>]
|
|
265
265
|
>>
|
|
266
266
|
startxref
|
|
267
267
|
2273
|
|
@@ -93,7 +93,7 @@ endobj
|
|
|
93
93
|
(PDFKit)
|
|
94
94
|
endobj
|
|
95
95
|
12 0 obj
|
|
96
|
-
(D:
|
|
96
|
+
(D:20220215122941Z)
|
|
97
97
|
endobj
|
|
98
98
|
9 0 obj
|
|
99
99
|
<<
|
|
@@ -156,7 +156,7 @@ trailer
|
|
|
156
156
|
/Size 13
|
|
157
157
|
/Root 3 0 R
|
|
158
158
|
/Info 9 0 R
|
|
159
|
-
/ID [<
|
|
159
|
+
/ID [<d0b9a4fc8c3aec755303bf2ccdbbeec3> <d0b9a4fc8c3aec755303bf2ccdbbeec3>]
|
|
160
160
|
>>
|
|
161
161
|
startxref
|
|
162
162
|
1365
|
|
@@ -1561,7 +1561,7 @@ endobj
|
|
|
1561
1561
|
(PDFKit)
|
|
1562
1562
|
endobj
|
|
1563
1563
|
135 0 obj
|
|
1564
|
-
(D:
|
|
1564
|
+
(D:20220215122941Z)
|
|
1565
1565
|
endobj
|
|
1566
1566
|
132 0 obj
|
|
1567
1567
|
<<
|
|
@@ -1754,7 +1754,7 @@ trailer
|
|
|
1754
1754
|
/Size 136
|
|
1755
1755
|
/Root 3 0 R
|
|
1756
1756
|
/Info 132 0 R
|
|
1757
|
-
/ID [<
|
|
1757
|
+
/ID [<f623efc134e757be2aa926a9c8758da9> <f623efc134e757be2aa926a9c8758da9>]
|
|
1758
1758
|
>>
|
|
1759
1759
|
startxref
|
|
1760
1760
|
19988
|
|
@@ -1561,7 +1561,7 @@ endobj
|
|
|
1561
1561
|
(PDFKit)
|
|
1562
1562
|
endobj
|
|
1563
1563
|
135 0 obj
|
|
1564
|
-
(D:
|
|
1564
|
+
(D:20220215122941Z)
|
|
1565
1565
|
endobj
|
|
1566
1566
|
132 0 obj
|
|
1567
1567
|
<<
|
|
@@ -1754,7 +1754,7 @@ trailer
|
|
|
1754
1754
|
/Size 136
|
|
1755
1755
|
/Root 3 0 R
|
|
1756
1756
|
/Info 132 0 R
|
|
1757
|
-
/ID [<
|
|
1757
|
+
/ID [<3c13959979f3c9d15da97b6a51e30c56> <3c13959979f3c9d15da97b6a51e30c56>]
|
|
1758
1758
|
>>
|
|
1759
1759
|
startxref
|
|
1760
1760
|
19988
|
|
@@ -605,7 +605,7 @@ endobj
|
|
|
605
605
|
(PDFKit)
|
|
606
606
|
endobj
|
|
607
607
|
15 0 obj
|
|
608
|
-
(D:
|
|
608
|
+
(D:20220215122941Z)
|
|
609
609
|
endobj
|
|
610
610
|
12 0 obj
|
|
611
611
|
<<
|
|
@@ -671,7 +671,7 @@ trailer
|
|
|
671
671
|
/Size 16
|
|
672
672
|
/Root 3 0 R
|
|
673
673
|
/Info 12 0 R
|
|
674
|
-
/ID [<
|
|
674
|
+
/ID [<abc8b7354e9f27588bab602d54553185> <abc8b7354e9f27588bab602d54553185>]
|
|
675
675
|
>>
|
|
676
676
|
startxref
|
|
677
677
|
13550
|
|
@@ -130,7 +130,7 @@ endobj
|
|
|
130
130
|
(PDFKit)
|
|
131
131
|
endobj
|
|
132
132
|
18 0 obj
|
|
133
|
-
(D:
|
|
133
|
+
(D:20220215122941Z)
|
|
134
134
|
endobj
|
|
135
135
|
15 0 obj
|
|
136
136
|
<<
|
|
@@ -199,7 +199,7 @@ trailer
|
|
|
199
199
|
/Size 19
|
|
200
200
|
/Root 3 0 R
|
|
201
201
|
/Info 15 0 R
|
|
202
|
-
/ID [<
|
|
202
|
+
/ID [<0a16027c63fb95570563f708485454b0> <0a16027c63fb95570563f708485454b0>]
|
|
203
203
|
>>
|
|
204
204
|
startxref
|
|
205
205
|
1946
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Center alignment.pdf
CHANGED
|
@@ -63,7 +63,7 @@ endobj
|
|
|
63
63
|
(PDFKit)
|
|
64
64
|
endobj
|
|
65
65
|
12 0 obj
|
|
66
|
-
(D:
|
|
66
|
+
(D:20220215122941Z)
|
|
67
67
|
endobj
|
|
68
68
|
9 0 obj
|
|
69
69
|
<<
|
|
@@ -126,7 +126,7 @@ trailer
|
|
|
126
126
|
/Size 13
|
|
127
127
|
/Root 3 0 R
|
|
128
128
|
/Info 9 0 R
|
|
129
|
-
/ID [<
|
|
129
|
+
/ID [<bf64e5260d9e782e3ab92debb4138323> <bf64e5260d9e782e3ab92debb4138323>]
|
|
130
130
|
>>
|
|
131
131
|
startxref
|
|
132
132
|
1142
|