natancabral / pdfkit-table

Helps to draw informations in simple tables using pdfkit. #server-side. Generate pdf tables with javascript (PDFKIT plugin)
MIT License
93 stars 59 forks source link

correction on page break when cell is too height #57

Open simon-ezacae opened 2 years ago

ELIONET commented 1 year ago

@natancabral Could you please accept this pull request ?

fellmann commented 1 year ago

@simon-feamzy

  1. I found the correct calculation to be: if (options.useSafelyMarginBottom && rowBottomY + rowHeight + columnSpacing + safelyMarginBottom >= maxY && !lockAddPage) onFirePageAdded(); You were missing columnSpacing.
  2. You fixed the bug in line 661, same bug is in line 811

@natancabral This seems a critical bug to me. Is this library still maintained?

fellmann commented 1 year ago

Plus, if the calculation is fixed, I would propose to reduce the magic safelyMarginBottom. Either to 0, or a small fixed amount like

let safelyMarginBottom = 14 /* points = 0.5 cm */

Right now, it is half the top margin, which is a problem with a large top margin e.g. if there is a letterhead.

fellmann commented 1 year ago

P.S.: fixes https://github.com/natancabral/pdfkit-table/issues/62