Hi, I tried to create my own header with PdfPageEventHelper and I used the example head_foot.java. There is a table (which should work as header) in my document, but at the wrong position at page 1, but page 2 is correct (except of the missing space between header and the other table). pdf-file is attached. I use the document in landscape format. Here's some code:
public void onEndPage(PdfWriter writer, Document document)
{
try
{
com.lowagie.text.Rectangle page = document.getPageSize();
PdfPTable head = new PdfPTable(3);
PdfPCell cell;
Phrase ph = new Phrase("Sortierung");
cell = new PdfPCell(ph);
cell.setHorizontalAlignment(cell.ALIGN_CENTER);
head.addCell(cell);
ph = new Phrase("Statistik-Name");
cell = new PdfPCell(ph);
cell.setHorizontalAlignment(cell.ALIGN_CENTER);
head.addCell(cell);
ph = new Phrase("Berichtszeitraum");
cell = new PdfPCell(ph);
cell.setHorizontalAlignment(cell.ALIGN_CENTER);
head.addCell(cell);
head.setTotalWidth(page.width() - document.leftMargin() -
document.rightMargin());
head.writeSelectedRows(0, -1, document.leftMargin(), page.height() -
document.topMargin() + head.getTotalHeight(),
writer.getDirectContent());
}
catch (Exception e) {throw new ExceptionConverter(e);}
}
So, it would be really great if anyone can tell me, how to place the header
at the first page correctly.
Thanks and regards,
Katrin
--
+++ GMX - die erste Adresse f�r Mail, Message, More +++
1 GB Mailbox bereits in GMX FreeMail http://www.gmx.net/de/go/mail
test1.pdf
Description: Adobe PDF document
