I'm using the following Java code to fill an pdf Template with itext
PdfReader pdfTemplate = getPdfReader(templateFile);
PdfStamper stamper = new PdfStamper(pdfTemplate, writer);
stamper.getAcroFields().setField("#ID", "1");
stamper.getAcroFields().setField("#value", "27");
stamper.getAcroFields().setField("#valuexxx", "99");
stamper.setFormFlattening(true);
// TODO Dynamic Table
stamper.close();
pdfTemplate.close();
an now my problem:
I would replace an textfield in the PDF with a Table dynamic length.
I've tryed
float[] fieldPosition= pdfTemplate.getAcroFields().getFieldPositions("tableField");
PdfPTable table = buildTable();
PdfContentByte cb = stamper.getOverContent(1);
table.writeSelectedRows(0, -1, fieldPosition[1],fieldPosition[4],cb);
this works fine but when after the field is some content the table "overides it", the secound problem is when the table has more rows than the page can hold.
Has someone a good idea how to realy replace a field and rebuild the following document?