I'm using iText 5.3.4
with Eclipse Kepler
. I have a bill table, normally it would not have more than one page, but for testing pourposes i've been checking it's behaviour and I'm facing a weird problem, table width
changes when page changes:
My table definition:
PdfPTable tableFactura = new PdfPTable(4);
tableFactura.setWidthPercentage(80f);
tableFactura.setWidths(new int[]{55, 15, 15, 15});
tableFactura.setKeepTogether(false);
tableFactura.setHeaderRows(1);
If i define different width the problem still persist, but with another dimensions.
The table is filled in a for-loop
with PdfCell
and Paragraph
inside, nothing complex:
// ONE of the CELLS of each line
cell = new PdfPCell(new Paragraph(factura.get("descripcion_linea" + numeroLinea), tinyNormal));
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
cell.setPaddingLeft(10f);
cell.setPaddingTop(5f);
cell.setBorder(Rectangle.LEFT);
tableFactura.addCell(cell);
My document is standard, Document document = new Document();
, i tried including also document.setPageSize(PageSize.A4);
but nothing changes. As you can see in the image, i've also tried without content in cells.
Any idea why is this happening?
UPDATE1: as suggested by @Bruno here is Link To File.
UPDATE2: here is a piece of code "simulating" what I am doing, but issue is NOT happening