I'm trying to create a table whose cells must be of fixed width and height (it's for printable labels). Any tips on how to do it? I'm using writeHTMLCell but the text overflows vertically.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'd check the text using getNumLines() to get the height of the text before drawing the table and then adjust the text as necessary (by trimming or changing text size).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there no way to just cut the overflown text? Your approach seems complex. I'd have to crop the text iteratively until it fits, and even so it seems that it could overflow anyway in the end.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Another option is to create each label as a separate PDF then import them back onto your printable sheets (only importing the first page of each pdf which would crop the label).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm trying to create a table whose cells must be of fixed width and height (it's for printable labels). Any tips on how to do it? I'm using writeHTMLCell but the text overflows vertically.
Are you saying the text is too big for the cell and you need it to auto resize the text?
Yes, the text sometimes is too big. I could either resize it or just crop it. But the cells must not be resized.
I'd check the text using getNumLines() to get the height of the text before drawing the table and then adjust the text as necessary (by trimming or changing text size).
Is there no way to just cut the overflown text? Your approach seems complex. I'd have to crop the text iteratively until it fits, and even so it seems that it could overflow anyway in the end.
Have you tried using css, "overflow: hidden;". I don't know if that is supported but that is what you are asking for.
Didn't work. I also tried http://stackoverflow.com/questions/8163937/tcpdf-clip-text-to-cell-width
Another option is to create each label as a separate PDF then import them back onto your printable sheets (only importing the first page of each pdf which would crop the label).