My header is bunched up against my 1st table. It doesn't seem to matter how wide I make the margins. I thought maybe the "setSpacingBefore" would work but it doesn't seem to.
Thanks for any Help,
Becky Peltz
Here's how I create my table:
private PdfPTable createLaneTable() {
PdfPTable table = new PdfPTable(colWidths15);
table.setTotalWidth(500f);
table.setSpacingBefore(10f);
table.getDefaultCell().cloneNonPositionParameters(borderAll);
table.getDefaultCell().setPadding(0f);
table.setHeaderRows(1);
PdfPCell headerCell =getDocUtil().makeCell(data.getOrigin()+ " -- " + data.getDestination(),FONT8TRBOLD,borderAll);
headerCell.setColspan(2);
headerCell.setBackgroundColor(Color.pink);
table.addCell(headerCell);
return table;
}
Here's my header/footer code:
public void onEndPage(PdfWriter writer, Document document){
float fudgeFactor = 10;
try{
Rectangle page = document.getPageSize();
PdfPTable head = new PdfPTable(colWidths212);
PdfPTable branchTable = new PdfPTable(1);
branchTable.addCell(docUtil.makeCell("EXPEDITORS INTERNATIONAL -DFW",FONT6TR,border0));
branchTable.addCell(docUtil.makeCell("506 E. Dallas Rd",FONT6TR,border0));
branchTable.addCell(docUtil.makeCell("Suite 400",FONT6TR,border0));
branchTable.addCell(docUtil.makeCell("012345678901234567890123456789012345678901234567890123456789012",FONT6TR,border0));
//for (int k = 1; k <= 6; ++k)
// head.addCell("head " + k);
head.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin() + fudgeFactor);
head.addCell(docUtil.makeCell("image",FONT8TRBOLD,border0));
head.addCell(docUtil.makeCell("",FONT6TR,border0));
head.addCell(docUtil.makeCell(branchTable,FONT6TR,border0));
head.writeSelectedRows(0, -1, document.leftMargin(), page.height() - document.topMargin() + branchTable.getTotalHeight(),
writer.getDirectContent());
PdfPTable foot = new PdfPTable(1);
foot.setHorizontalAlignment(Element.ALIGN_CENTER);
//for (int k = 1; k <= 6; ++k)
// foot.addCell("foot " + k);
foot.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin());
PdfPCell footCell1 = docUtil.makeCell("@2005 Property of Expeditors International of Washington, Inc. and its subsidiaries.",FONT6TR,border0);
footCell1.setHorizontalAlignment(Element.ALIGN_CENTER);
foot.addCell(footCell1);
PdfPCell footCell2 = docUtil.makeCell("BusinesssConfiential and proprietary, this information may not be repoducded in any form without advance writtten consent of an authorized officer of the copyright holder.",FONT6TR,border0);
footCell2.setHorizontalAlignment(Element.ALIGN_CENTER);
foot.addCell(footCell2);
foot.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(),
writer.getDirectContent());
}
catch (Exception e) {
throw new ExceptionConverter(e);
}
}
-----------------------------------------
Rebecca Peltz
Java Developer
Expeditor's International
206.674.3400 x 4120
-----------------------------------------