-
Notifications
You must be signed in to change notification settings - Fork 142
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
Table row on new page - render issue #191
Comments
Thanks for the report and for providing a minimal example, highly appreciated! Version Please let me know if it works for you now and if yous till see other issues. |
Hi, Thanks so much for getting back to me and releasing a new version. The changes you've made have indeed fixed the issue produced by the code snippet I provided. However, I'm still seeing an issue with overlapping text in a row that has broken onto a new page. I've tried to cut my application code down to the minimum I can and still produce the issue. Please see the pdf attached and the code below. Thanks,
|
Hi @rkusa , sorry to chase - have you had any chance to look into the issue described above? |
Don't worry, in this case it was good that you are asking again, since I've somehow missed the notification for your comment. I found the bug. When moving already rendered stuff to the next page, the cells rendered afterwards must be moved down by the height of the moved stuff. However, this only works for the first cell and is bugged for all succeeding cells. Unfortunately, I was unable to find a reasonable solution - at least during the time I reserved for this issue today. It seems that tables in tables (or tables in cells) isn't working very reliable, yet. A workaround for now would be to not nest tables and achieve the horizontal border grouping via the const renderTable = ({ rows, doc, headingWidth = 125 }) => {
const borderColor = 0xe2e3e5;
const table = doc.table({
widths: [headingWidth, null],
borderVerticalWidth: 1,
borderHorizontalWidths: (i) => {
// TODO: something else that takes into account that some "groups" have only 2 rows
return i % 3 === 0
},
borderColor,
});
for (let i = 0; i < rows.length; i += 1) {
const values = rows[i];
for (let j = 0; j < values.length; j += 1) {
const { heading, value } = values[j];
const row = table.row({
paddingTop: 5,
paddingRight: 5,
paddingLeft: 5,
paddingBottom: j === values.length - 1 ? 5 : 0,
});
row.cell(heading, {
font: helveticaBoldFont,
textAlign: 'right',
});
row.cell(value);
}
}
}; |
@rkusa Your solution has solved the issue for me. Thanks so much. |
Hi,
I'm seeing various different render issues on table rows that break onto a new page. Sometimes the row overlaps with the row below it, sometimes the the spacing within a cell is increased, etc. I'm struggling to pin point exactly what is causing this so its been difficult to provide a small code sample that reproduces it but I've managed to find something that shows one of the render issues shown in the attached pdf:
table-row-render-issue.pdf
Any help would be greatly appreciated.
Thanks,
The text was updated successfully, but these errors were encountered: