I'm creating a pdf document with a grid table based on the PdfPTable in itextpdf. The input data arrives as a java String[][] with all the cells filled. For each column, I iterate over all the rows to identify the maximum columns required to display the data for that column. That becomes the column width. All of the column widths are summed to determine the maximum number of columns for the entire table. At this point, my intent is to calculate the optimum point size for a monospace font to fully occupy the width of the columns. The objective is maximum readability in the face of very dynamic input data. For wide columns, I'm ending up with lots of trailing whitespace instead of filling the column nicely from left to right. A left justified appearance inside the column is desirable. The runtime environment is openjdk-1.6.0 on RHEL5.X. Any fonts in use must be resident on the system as it has no outside connectivity.
The code is fully up and running, but the appearance could be better if the column text fully occupied the column fieids.