Hi Paulo,
I took a look at the PdfDocument code and modified the handling of
ListItems according to the Paragraph handling. It worked immediately!
Here's the patch ;-)
Best regards,
Christian
case Element.LISTITEM: {
// we cast the element to a ListItem
ListItem listItem = (ListItem) element;
float spacingBefore = listItem.spacingBefore();
if (spacingBefore != 0) {
leading = spacingBefore;
carriageReturn();
if (!pageEmpty) {
/*
* Don't add spacing before a paragraph if
it's the first
* on the page
*/
Chunk space = new Chunk(" ");
space.process(this);
carriageReturn();
}
}
// we adjust the document
alignment = listItem.alignment();
listIndentLeft += listItem.indentationLeft();
indentRight += listItem.indentationRight();
leading = listItem.leading();
carriageReturn();
// we prepare the current line to be able to show us
the listsymbol
line.setListItem(listItem);
// we process the item
element.process(this);
float spacingAfter = listItem.spacingAfter();
if (spacingAfter != 0) {
leading = spacingAfter;
carriageReturn();
if (currentHeight + line.height() + leading <
indentTop() - indentBottom()) {
/*
* Only add spacing after a paragraph if the
extra
* spacing fits on the page.
*/
Chunk space = new Chunk(" ");
space.process(this);
carriageReturn();
}
leading = listItem.leading(); // restore
original leading
}
// if the last line is justified, it should be
aligned to the left
// if (line.hasToBeJustified()) {
// line.resetAlignment();
// }
// some parameters are set back to normal again
carriageReturn();
listIndentLeft -= listItem.indentationLeft();
indentRight -= listItem.indentationRight();
break;
}
On Wed, 2004-09-22 at 12:24, Paulo Soares wrote:
> I would be worried if it was the other way around. It doesn't look too
> difficult to fix but with PdfDocument you never know...
>
> Best Regards,
> Paulo Soares
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of Christian Lauer
> > Sent: Wednesday, September 22, 2004 7:06 AM
> > To: iText Mailing List
> > Subject: [iText-questions] Vertical spacing control for ListItems
> >
> > Hi Paulo,
> >
> > first of all I'd like to thank you for the excellent support so far, I
> > really appreciate it!
> >
> > I have played a bit with lists and have found out, that the ListItem
> > class extends the Paragraph class. Then I tested the new vertical
> > spacing features of Paragraphs (spacingBefore and spacingAfter). I've
> > found out that it works only when rendered by a ColumnText, but not in
> > case the List is directly added to the document.
> >
> > Best regards,
> > Christian
> >
> > --
> > Christian Lauer <[EMAIL PROTECTED]>
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> > Project Admins to receive an Apple iPod Mini FREE for your
> > judgement on
> > who ports your project to Linux PPC the best. Sponsored by IBM.
> > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
> > _______________________________________________
> > iText-questions mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
> >
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
--
Christian Lauer <[EMAIL PROTECTED]>
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions