The bug is probably solved. Replace this code section in PdfDocument. This
also adjusts the destination height correctly for rotated pages.
case Element.SECTION:
case Element.CHAPTER: {
// Chapters and Sections only differ in their constructor
// so we cast both to a Section
Section section = (Section) element;
// if the section is a chapter, we begin a new page
if (section.isChapter()) {
newPage();
}
// otherwise, we begin a new line
else {
newLine();
}
float fith = indentTop() - currentHeight;
int rotation = thisPageSize.getRotation();
if (rotation == 90 || rotation == 180)
fith = thisPageSize.height() - fith;
PdfDestination destination = new PdfDestination(PdfDestination.FITH,
fith);
while (currentOutline.level() >= section.depth()) {
currentOutline = currentOutline.parent();
}
PdfOutline outline = new PdfOutline(currentOutline, destination,
section.title(), section.isBookmarkOpen());
currentOutline = outline;
// some values are set
carriageReturn();
indentLeft += section.indentationLeft();
indentRight += section.indentationRight();
PdfPageEvent pageEvent = writer.getPageEvent();
if (pageEvent != null)
if (element.type() == Element.CHAPTER)
pageEvent.onChapter(writer, this, indentTop() - currentHeight,
section.title());
else
pageEvent.onSection(writer, this, indentTop() - currentHeight,
section.depth(), section.title());
// the title of the section (if any has to be printed)
if (section.title() != null) {
isParagraph = false;
add(section.title());
isParagraph = true;
}
indentLeft += section.indentation();
// we process the section
element.process(this);
// some parameters are set back to normal again
indentLeft -= section.indentationLeft() + section.indentation();
indentRight -= section.indentationRight();
if (pageEvent != null)
if (element.type() == Element.CHAPTER)
pageEvent.onChapterEnd(writer, this, indentTop() -
currentHeight);
else
pageEvent.onSectionEnd(writer, this, indentTop() -
currentHeight);
break;
}
case Element.LIST: {
Best Regards,
Paulo Soares
----- Original Message -----
From: "Paulo Soares" <[EMAIL PROTECTED]>
To: "Chris Ward" <[EMAIL PROTECTED]>; "iText (E-mail)"
<[EMAIL PROTECTED]>
Sent: Saturday, August 03, 2002 20:07
Subject: Re: [iText-questions] Is there a way to not page break automaticly
when adding a chapter?
> It's a bug. Some chapter processing is done before issuing the new page
> and
> that causes problems if the page has changed dimensions. Maybe Bruno can
> have a look at it, it's more in his department.
>
> Best Regards,
> Paulo Soares
>
> ----- Original Message -----
> From: "Chris Ward" <[EMAIL PROTECTED]>
> To: "iText (E-mail)" <[EMAIL PROTECTED]>
> Sent: Saturday, August 03, 2002 18:11
> Subject: [iText-questions] Is there a way to not page break automaticly
> when
> adding a chapter?
>
>
> > When I add a chapter, itext always inserts a page break. That would be
> > fine, because I do want one, but I need to set the page size (rotate
> or
> > not) before a page break happens. Is there a way to not page break
> > unless i tell it to?
> >
> > Example of what i am doing:
> >
> > document.setPageSize(PageSize.A4);
> > document.newPage();
> > document.add( chapter1 );
> > document.setPageSize(PageSize.A4.rotate());
> > document.newPage();
> > document.add( chapter2 );
> > document.setPageSize(PageSize.A4);
> > document.newPage();
> > document.add( chapter3 );
> > document.setPageSize(PageSize.A4.rotate());
> > document.newPage();
> > document.add( chapter4 );
> > document.setPageSize(PageSize.A4);
> > document.newPage();
> > document.add( chapter5 );
> >
> > This does not set the right pages to rotated or not as I expected,
> > because it seems that the .newPage() is called after inserting the
> > chapter; so when I uses .setPageSize() it for two pages out?
> >
> > Chris
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > iText-questions mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions