Coordinate system scaling

Coordinate system scaling

Forum member · May 14, 2009
Hello, I have previously asked for support regarding scaling tables to fit to page width and height. The way we have achieved this (with your help) has been by scaling font sizes. The problem we have now is that some of our clients require fitting a table exactly to a single page. By "exactly" I mean we need to be able to scale content using different multipliers for the x and y axes. Scaling font sizes involves applying a single multiplier to these axes. If this isn't clear just think about how you scale sides of a rectangle to have the same dimensions of another rectangle. Can you let me know if this sort of transformation is possible? If not is it possible to add this functionality to a future release? In terms of creating PDF reports its becoming a common change request from our clients and we need to solve this issue sooner rather than later. Thanks, Damien

Re: Coordinate system scaling

Support · May 14, 2009
Hello Damien, In order to scale the table to fit in a single page you will have to readjust the table's font size which adjusts the row height. You will have to decrease the font size until you do not have an overflow of the table. Below is a sample code for this. You can set the height and width of the table to the page height and width using the table's properties. Document document = new Document(); Page page = new Page(); Table table = new Table(0, 0, 0, 0); table.Height = page.Dimensions.Body.Height; table.Width = page.Dimensions.Body.Width; table.Columns.Add(50); table.Columns.Add(50); for (int i = 0; i < 100; i++) { Row row = table.Rows.Add(); row.Padding = 0; Cell c1 = row.Cells.Add("cell 1 " + i.ToString()); Cell c2 = row.Cells.Add("cell 2"); } float fontSize = 20; do { table.FontSize = fontSize; fontSize = fontSize - 0.5F; } while (table.GetOverflowRows() != null); page.Elements.Add(table); document.Pages.Add(page); document.DrawToWeb(); Thanks, ceTe Software Support Team.

Re: Coordinate system scaling

Forum member · May 19, 2009
Hello, This snippet didn't solve my problem but it did make me realise that I can also set column widths so that the table appears to fill the page. So thanks for the help! Cheers, Damien