we are using iText PDFPTable. The problem we are facing is because of the following line of code:
table.setHeaderRows(headerRows);
This piece of code works fine in local environment (WAS hosted in windows), but doesn't work, alignment is messed up, in dev server (WAS hosted in Unix). We are unable to figure out what the problem is, as in both cases IE is used. Can someone please answer why alignment issues come up in dev server? adding more code... method creating standard table:
public PdfPTable createStandardTable(int columnCount, int headerRows) {
zebraTable = true;
horizontalBorders = false;
PdfPTableEvent tableEvent = new PdfPTableEvent()
{
// begin (another) anonymous inner class extends PdfPTableEvent
@Override
public void tableLayout(PdfPTable table, float[][] width, float[] height,
int headerRows, int rowStart, PdfContentByte[] canvas) {
// code provided by Bruno Lowagie, author of iText, via StackOverflow.
float widths[] = width[0];
float x1 = widths[0];
float x2 = widths[widths.length - 1];
float y = height[height.length - 1];
PdfContentByte cb = canvas[PdfPTable.LINECANVAS];
cb.moveTo(x1, y);
cb.lineTo(x2, y);
cb.setColorStroke(TABLE_BORDER_COLOR);
cb.stroke();
}
// end anonymous inner class extends PdfPTableEvent
};
PdfPTable table = tableCreationHelper(columnCount, headerRows);
table.setTableEvent(tableEvent);
return table;
}
private helper method
private PdfPTable tableCreationHelper(int columnCount, int headerRows) {
PdfPTable table = new PdfPTable(columnCount);
table.setSpacingBefore(TABLE_SPACING);
table.setSpacingAfter(TABLE_SPACING);
table.setWidthPercentage(TABLE_WIDTH_PERCENT);
table.setHeaderRows(headerRows);
return table;
}
please let me know if you need more information
Thanks much, Babu.