Hi Paulo,
in Version 1.01 / Paulo 126 of iText the bug with the infinite loop in very
big table cells and "cellsfitpage" set to "true" seems to be still there.
Do we have to pull a newer version from CVS?
Thanks,
Peter
An Example code:
public class TableLooping {
public static void main(String[] args) {
Document document = new Document(PageSize.A4, 50, 50, 50,
50);
try {
PdfWriter writer = PdfWriter.getInstance(document,
new FileOutputStream("c:/temp/TableLooping.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
document.newPage();
Table table = new Table(2);
table.setCellsFitPage(true);
Cell aCell = new Cell();
for (int i = 1; i <= 100; ++i) {
aCell.add(new Chunk("this is a short
text"));
}
for (int k = 1; k <= 5; ++k) {
table.addCell(aCell);
}
document.add(table);
document.close();
System.out.println("Finished.");
}
catch (Exception e) {
e.printStackTrace();
}
}
}
-----Urspr�ngliche Nachricht-----
Von: Paulo Soares [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 20. November 2003 15:16
An: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Betreff: RE: [iText-questions] very strange error with itext, please
help
Are you using the last iText version?
There was a problem with Table that caused an infinite loop.
Best Regards,
Paulo Soares
> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]
> Sent: Thursday, November 20, 2003 5:11
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] very strange error with itext, please help
>
> Hello, I am generating pdf using itext from a db source through a servlet
> on weblogic6.1 and displays the pdf back in a webpage. The input for
> generating the pdf are just a bunch of user selected filters on a webpage.
>
>
> I encountered a very strange bug: java.lang.OutOfMemoryError <<no stack
> trace available>>. I know this error occurs when generating large pdfs but
> that is not the case.
> The servlet calls a bunch of stored procs in the db and add the resultsets
> from them to a itext Table. Now for example, with input1 it generates a
> 150+ page of pdf perfectly, then I changed the filter to input2 and i get
> an out of memory error. However input two only suppose to generate like 20
> pages and I verified both the stored proc and java sql codes. The program
> runs until doc.add(datatable) then i get the out of memory error. My itext
> table contains 16 columns with 3 of them containing large amount of text
> (Text column datatype used in DB).
>
> After some testing I noticed:
>
> This is the header of my table:
> /*********** If I comment out the addCell(title) codes, everything
> works****
> ************ If I dont, i get out of memory error in certain inputs
> *******/
> datatable.addCell(new Phrase("title1",
> FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD)));
> datatable.addCell(new Phrase("title2",
> FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD)));
> datatable.addCell(new Phrase("title3",
> FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD)));
> datatable.addCell(new Phrase("title4"
> FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD)));
>
> ........etc
> datatable.addCell(new Phrase("title16",
> FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD)));
> /*************************************************************************
> *********/
>
> Cell spacer = new Cell(new Phrase(" ",
> FontFactory.getFont(FontFactory.HELVETICA_BOLD, 5, Font.BOLD)));
> spacer.setBorder(Rectangle.NO_BORDER);
> spacer.setColspan(NumCol);
>
> /*********** If I comment out the addCell(spacer) code, everything
> works****
> ************ If I dont, i get out of memory error in certain inputs
> *******/
> datatable.addCell(spacer);
>
> datatable.endHeaders();
>
> so basically if i comment out either the header name or the spacer,
> everything works fine. If i leave them both in, i get out of memory
> errors. Why is this happening? The total length of the pdf report is only
> 20ish pages how is an extra row of blank space causing it to go out of
> memory? especially since it can generate pdf with 150+ pages with no
> problem whatsoever. Please help, I cant seem to find any solution to this.
>
> Also in general what causes out of memory errors other than just a really
> large pdf.
>
> Thank you,
>
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions