0

I have a PDF template having two pages. In the template content is static except few fields are dynamic. I am reading the PDF template from a folder and replacing the AcroFields with some dynamic values.Which is working fine.

I Want to place a dynamic table in the second page of the PDF at a fixed position(in the middle of the 2nd page).

The table will have fixed columns and rows will be dynamic.

I go through link and link but it is placing the table at end of the document or stating of the document.

EDIT : Tried to place a AcroField on the place where I want to insert the table. But in the code behind I have generated the table but unable to replace the acrofield value with a table object.

Any help will be appreciated.

EDIT -2 : Now I am able insert the table in the second page using the below code. But another issue is if the table rows are increasing it overlapping the content which is exists below of the table. How can move the content to down if table height is increasing.

IList<AcroFields.FieldPosition> fieldPositions = fields.GetFieldPositions("Table");
            AcroFields.FieldPosition fieldPosition = fieldPositions[0];
            PdfPTable table = Table();
            PdfContentByte cb = stamper.GetOverContent(2);
            table.WriteSelectedRows(0, -1, fieldPosition.position.Left, fieldPosition.position.Top, cb);
            stamper.FormFlattening = true;
            stamper.Close();
Community
  • 1
  • 1
  • I just wanted to start answering your original question and now see you found out yourself. Oh well. Concerning your follow-up question: *How can move the content to down if table height is increasing.* - That is not really a task PDFs are made for, content in PDFs is meant to be located at a fixed position. If you could split that original page in two page, the first one containing the part above the insertion point, the second one the part below, you could use the `PdfDenseMergeTool` (cf. [this answer](http://stackoverflow.com/a/28024276/1729265)) to patch the pieces together. – mkl Jan 12 '16 at 07:30
  • @mkl --Thank you for your time and suggestion . Will try it and let you know the status.. – Priya Biswal Jan 12 '16 at 10:05

0 Answers0