4

There is a iText 7.0.7 method of table that works:

Table table = new Table(new float [] {4,1,3,4,3,3,3,3,1});
table.setWidthPercent(100);

But in iText 7.1.2 this method is not found:

table.setWidthPercent(100);

They know what the new method is or where it has moved, please.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

9

Please try

table.setWidth(UnitValue.createPercentValue(100)):

In iText 7.1.x many dimension properties have been generalized to contain a UnitValue instance which can be either absolute (in points) or relative (in percent).

mkl
  • 90,588
  • 15
  • 125
  • 265
  • Thanks if it works! One more query, the Color class does not exist in this version 7.1.2 You know where he has moved, or where I find more information. import com.itextpdf.kernel.color.Color; import com.itextpdf.kernel.color.DeviceCmyk; – David Pacheco Jimenez Aug 10 '18 at 15:21
  • 1
    About a year a go the package `com.itextpdf.kernel.color` has been renamed to `com.itextpdf.kernel.colors`. – mkl Aug 10 '18 at 15:42