Hello. I am experiencing a bug in iText PDF generation where text overlaps an image. The situation is that there is a table cell containing an image. The cell starts on the bottom of a page and therefore it gets pushed to the next page (because it would not have fit). However, the text at the top of the next page does not get "pushed down" enough, so it ends up overlapping the table cell.
I have attached a short test program which reproduces the problem using the
latest iText SVN version. After two days of trying to fix this myself, I am
ready to ask Bruno or others on the list for help.
Please see the attached source code (with accompanying jpg) to see what I
am talking about.
Can someone suggest a fix or a workaround for this problem?
Thanks,
Chad Loder
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
public class TableImageTextOverwrite
{
public static void main(String[] args)
{
try
{
Document document = new Document();
PdfWriter.getInstance(document, new
FileOutputStream("example.pdf"));
document.open();
Image image = Image.getInstance("otsoe.jpg");
for (int i = 1; i <= 10; i++)
{
document.add(new Paragraph("Text chunk before table " + i));
Table table = new Table(1, 1);
Cell cell = new Cell();
cell.add(image);
table.addCell(cell);
document.add(table);
document.add(new Paragraph("Text chunk after table " + i));
}
document.close();
}
catch (Throwable t)
{
t.printStackTrace();
}
}
}<<attachment: otsoe.jpg>>
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
