On 28/07/2011 15:42, Jason Berk wrote:
> Is the rule "once you change margins, top/bottom/left/right may not
> return what you expect"?
The rule is:
- don't change margins in PdfDocument (in a page event), change them in 
Document (not in a page event).
- if you change them in Document, do so before triggering the newPage() 
method.
- the new margins will only be "active" on the next page.

I don't have the time to adapt, compile and execute your example, but 
this should be avoided:

public void onEndPage(PdfWriter writer, Document document) {
   doc.setMargins(LEFT, RIGHT, TOP, BIG_BOTTOM);
}

I see that you tried to work around the fact that document is actually a 
PdfDocument instance.
This is inventive (it surprised me), but I don't think it's a good idea.
Operations on the Document object trigger page events, and you're 
triggering operations on the Document inside page events.
I wouldn't bet on the outcome of such a workaround.

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to