public static void Run(string outputPdfPath) { // PDF to read form fields from PdfDocument pdfDocument = new PdfDocument(Util.GetResourcePath("PDFs/fw9AcroForm_18_filled.pdf")); // Create Table to display the form fields and values Table2 table = new Table2(0, 0, 512, 676, Font.Helvetica, 12); table.Border.Width = 1; table.Border.Color = RgbColor.Black; table.RepeatColumnHeaderCount = 1; table.RepeatRowHeaderCount = 1; BuildTable(table); CreateList(table, pdfDocument.Form.Fields); Document document = new Document(); AddTableToPage(document, table); Table2 overflowRowTable = table.GetOverflowRows(); while (overflowRowTable != null) { AddTableToPage(document, overflowRowTable); overflowRowTable = overflowRowTable.GetOverflowRows(); } document.Draw(outputPdfPath); }
public static void Run(string outputPdfPath) { // Create a document and set it's properties Document document = new Document { Creator = "TableReport", Author = "ceTe Software", Title = "Table Report" }; //Create a Table and set it's properties Table2 table = new Table2(0, 0, 512, 676, Font.Helvetica, 12); table.Border.Width = 1f; table.CellDefault.Border.Width = 1f; table.Border.Color = Grayscale.Black; table.RepeatColumnHeaderCount = 1; table.RepeatRowHeaderCount = 1; // Builds the report BuildTable(table); int currentRow = 0; int currentColumn = 0; do { currentRow++; currentColumn = 1; AddTableToPage(document, table, currentRow, currentColumn); Table2 overflowTable = table.GetOverflowColumns(); do { currentColumn++; AddTableToPage(document, overflowTable, currentRow, currentColumn); overflowTable = overflowTable.GetOverflowColumns(); } while (overflowTable != null); table = table.GetOverflowRows(); } while (table != null); // Outputs the SimpleReport to the current web page document.Draw(outputPdfPath); }