I'm writing a simple class who gets an iSeries spool file (text file with control code as first char of each line) and builds a PDF.
An option on the command line allows to place an image as header (in fact it's a Watermark) and another image as a footer, using onEndPage. There are some spool file that crash the class with StackOverflowError. I tried some debbugging, and it seems to occour because sometimes the carriageReturn() method in com.lowagie.text.pdf.PdfDocument (called by add(Element) when the type is IMGTEMPLATE) forces a NewPage() that fires another onEndPage event that tries to add another footer image, so the add(Element) method calls carriageReturn() that forces a NewPage() that fires a third onEndPage event and so on, until the Stack goes overflow. Commenting the carriageReturn() line (number 1760 in PdfDocument.java, iText 1.01), the class runs to the end and the resulting pdf seems quite acceptable. Obviously, it's a quick and dirty workaround. I think it would be better to inhibit the recursive call of newPage()-onEndPage() (why adding a page, and consequently a footer image, forces another page? The first page added is empty, isn't it? Maybe contentHeight, which is checked to decide if a newPage must be added, has to be reset somewhere?). I don't know very much iText library's internal structure yet, so I don't know exactly what to do. Greetings, Enrico Battocchi <[EMAIL PROTECTED]> --------------------------------------------------------- Stanco dello spam nella tua email? Prova GRATIS il nuovo servizio ANTISPAM di superEva: http://webmail.supereva.it/spam.html --------------------------------------------------------- ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
