proposal to add 'hard tables' mode, which throws an error rather than overflow a table cell of known height #2345
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For your consideration: a (Work In Progress) proposal to add a feature required by our team.
background
We are printing grids of labels and we use pdfmake to achieve that by dynamically generating tables that fit the label-sheets. We need to reliably print "within the lines", without the need for a visual inspection. The task is made more difficult because the content within each of the thousands of labels is unique.
before
When you give a table cell a known height, this height will only apply if the content fits within. If the content exceeds the capacity of the cell, this height is ignored and the cell simply gets larger. This forces our team to visually inspect documents with
diff-pdf
, which is a huge pain-point.after
This feature extends the LayoutBuilder with an extra mode, which we call "hard table mode". When enabled, the layout builder will throw an error rather than overflow a table cell of a known height. If a table cell is unable to fit its content, an error is thrown.
future work
We're also interested in extending this mode to work in the horizontal direction- that is, throw an error if the content of a column of a fixed width is too wide.
We'd prefer not to maintain a fork and thus we'd like y'all to review it and give us some feedback. I had taken care to keep the structure and format of your codebase, though it appears my editor has pretty-fied more than I had intended. Of course I'll try to clean that up later.
🙏