Enclose all the graphics in the body in a save/restore state otherwise the 
transformations will propagate to onEndPage. 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Tuesday, January 11, 2005 7:58 AM
> To: [email protected]
> Subject: [iText-questions] self-created header with PdfPageEventHelper
> 
> 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
> 


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to