bpampuch/pdfmake

Help needed: how can i forcefully prevent my table cell from wrapping onto the next page?

man-shar opened this issue · 3 comments

I am trying to contruct a pdf where i'm putting text inside a table cell because I want to control the width and height of the text. I"m using the solution suggested here and putting all text inside tables.

But in some cases, my table cells are wrapping onto the next page like so:

  1. I wonder why it's doing this?
  2. Any way I can prevent this?

Note the table with the black border in the below screenshot:

image

Hi, you can try this :

table: {
    dontBreakRows: true, 
}

A row cannot be split in half across pages

hmmm, yes but then it will take the whole row to the next page hehe.

image

Fwiw, there is an easier solution for me which is just increasing the page height to prevent it from hitting whatever threshold it's hitting for pagebreak. But i'm curious if there's a cleaner solution possible?

I'm only using table cells for my text because i need to give them width and height. I suppose there's no other way for me to get fixed-sized text?

Table is the correct solution. If you don't want to wrap cells use dontBreakRows: true as mentioned above of course it wraps whole row.