You ask:
===================
Does this work:
>         if (document.getPageNumber() == 1){
===================

Yes, it works. I've instrumented that with sys.out.println's and can see 
that it gets reliably fired on every page and the page number starts at 
one and increments the way you'd expect. I can try your suggestion but I 
don't think that's the root of the problem. 

You ask:
===================
And also, you set the total width:
> head.setTotalWidth(page.getWidth() - document.leftMargin() - 
> document.rightMargin());
but shouldn't you add head.setLockedWidth(true); as documented?
===================

That code snippet was copied wholesale from the tutorial example in Ch. 
14. If there was a call to setLockedWidth() I missed it when I 
copied-n-pasted. I'll give that a try. Can you give me the location of the 
"as documented" document? :-) thanks in advance - 

You ask:
===================
What is wrong with the resulting PDF?
===================
It has no headers. All the content, no headers whatsoever. Nada. zip. 
zilch. 

Thanks - dan fox

Message: 2
Date: Thu, 21 May 2009 17:55:21 +0200
From: 1T3XT info <i...@1t3xt.info>
Subject: Re: [iText-questions] changing headers
To: Post all your questions about iText here
                 <itext-questions@lists.sourceforge.net>
Message-ID: <4a157969.2030...@1t3xt.info>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Daniel Fox wrote:
> My onEndPage event looks like this:

Does this work:
>         if (document.getPageNumber() == 1){
Shouldn't it be writer.getPageNumber()
instead of document.getPageNumber()?

And also, you set the total width:
> head.setTotalWidth(page.getWidth() - document.leftMargin() - 
> document.rightMargin());
but shouldn't you add head.setLockedWidth(true); as documented?

> Does anyone have any suggestions?

These are two suggestions at first sight.

> Do you need more information?

Yes, define "I can't seem to get it to work".
What is wrong with the resulting PDF?
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to