DynaPdf: Text that does not exceed the width and the height of a cell

Hi all,

How to write text that does not go beyond a delimited area (for a label for example), so that the text is cut if it goes beyond the area?

I do not want the area (or cell, in a table) to expand with the text (neither in width nor height), nor does the text continue on the next page of course. I would like the area not to be flexible and the text not to exceed it. I tried the tables too, but…

Thank you

Did you try ktfNoLineBreak flag on the cells to avoid breaks?

Thank you Christian,

yes, but in this case, there is no new row actually, but the row exceeds the width of the column (and table). However, I set the extCol parameter to false in setColWidth.

On the screenshot below, we can see that the name of the first label overlaps the name of the second label. Each label is a table.


I just tried the latest version of DynaPdf, it’s the same thing.

I’ll ask Jens.
Alternative Approach could be to measure yourself with StringWIdth and than cut text yourself.

Thanks Christian! it actually works with getStringWidth, I missed this command. But it would be a good evolution to be able to do without it.