Responsive PDF Document

Responsive PDF Document

Forum member · Mar 25, 2025
I'm creating a PDF document consisting of a number of Labels, TextArea's and one Table2. The placement of the Page Elements are all done using x, y coordinates values. The issue is the Table is dynamic and can have n-number of rows displayed which isn't determined until "run-time" of the application. If I place Elements below the Table, there's a chance the Elements will be overwritten by the Table rows. One thought came to mind is have the table as last Element on the document. Is there a way to have the Elements below the Table adjust their position?

Re: Responsive PDF Document

Support · Mar 26, 2025
Hi, Yes. you can add TextArea, Label page elements below dynamic table without any problem using our DynamicPDF Core Suite for .NET product. You will need to calculate Y position and get the last page and table height and use these values to add elements after table laying is completed. Here is a code sample. float tabelht = 0; float tableYPosition = 0; Table2 table = new Table2(0, 0, 200, 692); table.Columns.Add(100); table.Columns.Add(100); for(int i=1;i<100;i++) { Row2 row1= table.Rows.Add(); row1.Cells.Add("Columns1: Text" + i); row1.Cells.Add("Columns2: Text" + i); } //Add table to document. Document document = new Document(); do { Page page = new Page(); document.Pages.Add(page); tableYPosition = table.Y; page.Elements.Add(table); tabelht = table.GetRequiredHeight(); table = table.GetOverflowRows(); } while (table != null); int currentPageNumber = document.Pages.Count -1; Page currentPage = document.Pages[currentPageNumber]; //Adding new TextArea below Table. float YPosition = tableYPosition + tabelht + 10; TextArea area = new TextArea("New Text below dynamic Table", 0, YPosition, 100, 40); currentPage.Elements.Add(area); string outputPdf = @"C:\Temp\MyTable.pdf"; document.Draw(outputPdf); Thanks, ceTe Software Support Team