Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/table cell vertical alignment #2436

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0aef943
Feat(Table cell vertical alignment) - for text, stack, columns, list,…
May 17, 2022
a0781c5
Fix: CRLF
May 17, 2022
640a9d1
Revert "Fix: CRLF"
May 17, 2022
f528db6
fix indentation
sirfullTom May 17, 2022
acdfca7
init sfs repo
sirfullTom May 17, 2022
7df5ef2
updated the build
sirfullTom May 18, 2022
5787e4a
Fix : function name & lineHeight
May 18, 2022
ad3e102
Merge branch 'feature/table_cell_vertical_alignment' of https://githu…
May 18, 2022
ecba23b
use paddingTop in processTableVerticalAlignment
sirfullTom Oct 25, 2022
0795850
Merge pull request #1 from SirFull/fix/padding-vertical-alignment
t0m-4 Oct 25, 2022
a46dee1
updated version
sirfullTom Oct 25, 2022
22607e0
Merge branch 'master' into release/vertical_alignment
sirfullTom Mar 23, 2023
e86a99e
build 0.3.0-beta.5
sirfullTom Mar 23, 2023
aec02a6
Merge branch 'release/vertical_alignment' into feature/table_cell_ver…
sirfullTom Mar 23, 2023
20092c6
update package name to remove @sirfull
sirfullTom Mar 23, 2023
8549dba
update oiriginal repo url
sirfullTom Mar 23, 2023
a2c12da
merge
t0m-4 Sep 6, 2024
859b34d
build
t0m-4 Sep 6, 2024
b7f8e5d
fix merge
t0m-4 Sep 6, 2024
2ea57b6
fix
t0m-4 Sep 6, 2024
16137d4
fix eslint
t0m-4 Sep 6, 2024
c7d31e6
fix eslitn verticalAlignment sample
t0m-4 Sep 6, 2024
6d77717
fix pr comments
t0m-4 Sep 9, 2024
997703e
merge
t0m-4 Sep 9, 2024
b201a40
reinit package json
t0m-4 Sep 9, 2024
15f666a
remove npmrc
t0m-4 Sep 9, 2024
f215a2a
build & exemples
t0m-4 Sep 9, 2024
f104326
up with last src repo
t0m-4 Sep 9, 2024
4b97f4e
up build & exemples
t0m-4 Sep 9, 2024
9dba972
publis package yml
t0m-4 Sep 9, 2024
d51d9c4
publish package
t0m-4 Sep 9, 2024
066d51b
stretch working
t0m-4 Sep 11, 2024
dc43438
fix
t0m-4 Sep 11, 2024
14de809
working with copy
sirfullTom Sep 11, 2024
de4063b
stretch heights on table working
sirfullTom Sep 12, 2024
1cb4475
fix lint
sirfullTom Sep 12, 2024
3546ce5
cleaning
sirfullTom Sep 12, 2024
fe745c1
cleaning
sirfullTom Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@SirFull:registry=https://npm.pkg.github.com
6,351 changes: 2,322 additions & 4,029 deletions build/pdfmake.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/pdfmake.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/pdfmake.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/pdfmake.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/vfs_fonts.js

Large diffs are not rendered by default.

Binary file modified examples/pdfs/absolute.pdf
Binary file not shown.
Binary file modified examples/pdfs/attachments.pdf
Binary file not shown.
Binary file modified examples/pdfs/background.pdf
Binary file not shown.
Binary file modified examples/pdfs/basics.pdf
Binary file not shown.
Binary file modified examples/pdfs/columns_simple.pdf
Binary file not shown.
Binary file modified examples/pdfs/images.pdf
Binary file not shown.
Binary file modified examples/pdfs/links.pdf
Binary file not shown.
Binary file modified examples/pdfs/lists.pdf
Binary file not shown.
Binary file modified examples/pdfs/margins.pdf
Binary file not shown.
Binary file modified examples/pdfs/named_styles.pdf
Binary file not shown.
Binary file modified examples/pdfs/named_styles_with_overrides.pdf
Binary file not shown.
Binary file modified examples/pdfs/pageReference.pdf
Binary file not shown.
Binary file modified examples/pdfs/qrCode.pdf
Binary file not shown.
Binary file modified examples/pdfs/relative.pdf
Binary file not shown.
Binary file modified examples/pdfs/security.pdf
Binary file not shown.
Binary file modified examples/pdfs/standardfonts.pdf
Binary file not shown.
Binary file modified examples/pdfs/styling_inlines.pdf
Binary file not shown.
Binary file modified examples/pdfs/styling_properties.pdf
Binary file not shown.
Binary file modified examples/pdfs/svgs.pdf
Binary file not shown.
Binary file modified examples/pdfs/tables.pdf
Binary file not shown.
Binary file modified examples/pdfs/textDecorations.pdf
Binary file not shown.
Binary file modified examples/pdfs/toc.pdf
Binary file not shown.
Binary file modified examples/pdfs/vectors.pdf
Binary file not shown.
Binary file added examples/pdfs/verticalAlignment.pdf
Binary file not shown.
Binary file modified examples/pdfs/watermark.pdf
Binary file not shown.
377 changes: 377 additions & 0 deletions examples/test.html

Large diffs are not rendered by default.

360 changes: 360 additions & 0 deletions examples/verticalAlignment.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@
]
}
}
}
}
21 changes: 19 additions & 2 deletions src/DocPreprocessor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isString, isNumber, isValue, isEmptyObject } from './helpers/variableType';
import { stringifyNode } from './helpers/node';
import { isEmptyObject, isNumber, isString, isValue } from './helpers/variableType';

const convertValueToString = value => {
if (isString(value)) {
Expand All @@ -23,7 +23,7 @@ class DocPreprocessor {
return this.preprocessNode(docStructure);
}

preprocessNode(node) {
checkNode(node) {
// expand shortcuts and casting values
if (Array.isArray(node)) {
node = { stack: node };
Expand All @@ -32,6 +32,12 @@ class DocPreprocessor {
} else if ('text' in node) { // cast value in text property
node.text = convertValueToString(node.text);
}
return node;
};

preprocessNode(node) {
//vertical alignment
node = this.checkNode(node);

if (node.columns) {
return this.preprocessColumns(node);
Expand Down Expand Up @@ -68,6 +74,10 @@ class DocPreprocessor {
let columns = node.columns;

for (let i = 0, l = columns.length; i < l; i++) {
//vertical alignment
columns[i] = this.checkNode(columns[i]);
columns[i].nodeRef = node.nodeRef ? columns[i].nodeRef = node.nodeRef: node;

columns[i] = this.preprocessNode(columns[i]);
}

Expand All @@ -78,6 +88,9 @@ class DocPreprocessor {
let items = node.stack;

for (let i = 0, l = items.length; i < l; i++) {
//vertical alignment
items[i] = this.checkNode(items[i]);
items[i].nodeRef = node.nodeRef ? node.nodeRef : node;
items[i] = this.preprocessNode(items[i]);
}

Expand All @@ -88,6 +101,10 @@ class DocPreprocessor {
let items = node.ul || node.ol;

for (let i = 0, l = items.length; i < l; i++) {
//vertical alignment
items[i] = this.checkNode(items[i]);
items[i].nodeRef = node.nodeRef ? node.nodeRef : node;

items[i] = this.preprocessNode(items[i]);
}

Expand Down
13 changes: 10 additions & 3 deletions src/ElementWriter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isNumber } from './helpers/variableType';
import { pack, offsetVector } from './helpers/tools';
import DocumentContext from './DocumentContext';
import { EventEmitter } from 'events';
import DocumentContext from './DocumentContext';
import { offsetVector, pack } from './helpers/tools';
import { isNumber } from './helpers/variableType';

/**
* A line/vector writer, which adds elements to current page and sets
Expand Down Expand Up @@ -125,6 +125,9 @@ class ElementWriter extends EventEmitter {
this.alignCanvas(node);

node.canvas.forEach(function (vector) {
//vertical alignment
vector.nodeRef = node.nodeRef ? node.nodeRef : node;

let position = this.addVector(vector, false, false, index);
positions.push(position);
if (index !== undefined) {
Expand Down Expand Up @@ -188,6 +191,10 @@ class ElementWriter extends EventEmitter {
let vector = qr._canvas[i];
vector.x += qr.x;
vector.y += qr.y;

//vertical alignment
vector.nodeRef = qr.nodeRef ? qr.nodeRef: qr;

this.addVector(vector, true, true, index);
}

Expand Down
Loading