Hi everybody,
I found a loop condition inside ColumnText class...it would be very usefull to 
avoid that, because it seems like nothing is going on...but it's looping!!!
I'm trying do execute this code:

int mLeft = 40;
int mRight = 40;
int mTop = 50;
int mBottom = 50;
Document document = new Document(PageSize.A4, mLeft, mRight, mTop, mBottom);
PdfWriter writer = PdfWriter.getInstance(document, new 
FileOutputStream("xxx.pdf"));
document.open();

Font font1 = new Font(Font.COURIER, 10f);
Chunk text = new Chunk("text text text text text", font1);
MultiColumnText column = new MultiColumnText();

float[][] left = {
{50f,790f,50f,60f},
{250f,790f,350f,500f,250f,60f}
};
float[][] right = {
{200f,790f,200f,700f,120f,600f,200f,500f,200f,60f},
{540f,790f,540f,60f}
};
column.addColumn(left[0], right[0]);
column.addColumn(left[1], right[1]);
for (int i = 0; i < 100; i++) {
column.addElement(text);
}
document.add(column);

This is the call tree into iText classes:
Document.add(Element)
 PdfDocument.add(Element)
  MultiColumnText.write(PdfContentByte, PdfDocument, float)
   boolean done = false
   while (!done) {
    ColumnText.go()
     ColumnText.go(boolean)
      rectangularMode = false
      ColumnText.findLimitsTwoLines()
       ColumnText.findLimitsOneLine()
        ColumnText.findLimitsPoint(ArrayList)
         ...
         if (yLine < minY || yLine > maxY) {
           lineStatus = LINE_STATUS_OFFLIMITS;
           return 0;
         }
     ...
     status = NO_MORE_COLUMN
    ...
    the "done" parameter will never be = true (LOOP)
   }

I suggest to add this code in ColumnText.go(boolean) after line 858:
 if (text.content.count == 0) {
   StringBuffer message = new StringBuffer();
   message.append("Check column edges: YLine=");
   message.append(yLine);
   message.append(" minY=");
   message.append(minY);
   message.append(" maxY=");
   message.append(maxY);
   message.append(" must be minY<=YLine<=maxY");
   throw new RuntimeException(message.toString());
 }

tks to all
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to