Discussion:
[iText-questions] Possible bug - List added to ListItem rendered incorrectly
Sherwood Hu
2015-06-09 18:05:36 UTC
Permalink
The code below (in .net) :



PdfContentByte cb = writer.DirectContent;

ColumnText ct = new ColumnText(cb);

ct.Alignment = Element.ALIGN_JUSTIFIED;

ct.SetSimpleColumn(72.0f, 72.0f, 8.5f * 72f - 72f, 11f * 72f
- 72f);



List list = new List(List.ORDERED);



ListItem item1 = new ListItem("item 1");



List nested= new List(List.ORDERED, List.ALPHABETICAL);

nested.Add(new ListItem("nested item 1"));

nested.Add(new ListItem("nested item 2"));

nested.Add(new ListItem("nested item 3"));



Paragraph para = new Paragraph("paragraph1");

para.IndentationLeft = 30;

item1.Add(para);

item1.Add(nested);

list.Add(item1);



ct.AddElement(list);

ct.Go();





In the PDF rendered, block elements inside ListItem item1 are all rendered
inline. Format information are lost.



The problem seems to exist only on ColumnText. If rendered directly to
Document the rendering is correct.
Sherwood Hu
2015-06-10 12:38:25 UTC
Permalink
The code below (in .net) :



PdfContentByte cb = writer.DirectContent;

ColumnText ct = new ColumnText(cb);

ct.Alignment = Element.ALIGN_JUSTIFIED;

ct.SetSimpleColumn(72.0f, 72.0f, 8.5f * 72f - 72f, 11f * 72f
- 72f);



List list = new List(List.ORDERED);



ListItem item1 = new ListItem("item 1");



List nested= new List(List.ORDERED, List.ALPHABETICAL);

nested.Add(new ListItem("nested item 1"));

nested.Add(new ListItem("nested item 2"));

nested.Add(new ListItem("nested item 3"));



Paragraph para = new Paragraph("paragraph1");

para.IndentationLeft = 30;

item1.Add(para);

item1.Add(nested);

list.Add(item1);



ct.AddElement(list);

ct.Go();





In the PDF rendered, block elements inside ListItem item1 are all rendered
inline. Format information are lost.



The problem seems to exist only on ColumnText. If rendered directly to
Document the rendering is correct.

Loading...