Hmmm... So, I guess that either I am nulling the output stream or Websphere is nulling it. I think I'll blame Websphere :)
Thanks for your help. -----Original Message----- From: Paulo Soares [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 05, 2005 6:34 PM To: Nathan Frank; itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] NullPointer while using PdfReader I've no idea. OutputStreamCounter is a wrapper for the doc OutputStream and that is never null, or is it? ----- Original Message ----- From: "Nathan Frank" <[EMAIL PROTECTED]> To: <itext-questions@lists.sourceforge.net> Sent: Tuesday, July 05, 2005 9:56 PM Subject: [iText-questions] NullPointer while using PdfReader Hello, I am experiencing a strange problem. I am using PdfReader to append a PDF file to my PDF document. I am using a servlet on IBM Websphere application server to generate this PDF, and return it to a browser. We are testing this on many different servers, which may or may not be configured the same. It works on some servers, and not on others. I have included a section of code, and part of the stack trace. I was just wondering if anyone has seen similar issues to this or has suggestions for fixing the problem. I was also wondering if I am doing something wrong in my code, or if there is a better/safer way to do this. thank you, Nathan if (debugLevel == 0 || ((debugLevel & 2) != 0)) { document.newPage(); /* append page */ /* start on Odd page so that the prior form is on one printable page */ if (writer.getPageNumber() % 2 == 0) { document.add(Chunk.NEWLINE); document.newPage(); } /* bookmark */ PdfDestination dest = new PdfDestination(PdfDestination.FITB); PdfOutline outline = new PdfOutline(cb.getRootOutline(), dest, "New Page"); outline.setOpen(false); /* import PDF */ InputStream is = getContentAsStream(); PdfReader reader = new PdfReader(is); for (int i = 1; i <=reader.getNumberOfPages();i++) { PdfImportedPage page = writer.getImportedPage(reader, i); cb.addTemplate(page, 0f,0f); if (i < reader.getNumberOfPages()) document.newPage(); } is.close(); } document.close(); [Servlet.LOG]: action: Connection.process: java.lang.NullPointerException at com.lowagie.text.pdf.OutputStreamCounter.write(OutputStreamCounter.java( Compiled Code)) at com.lowagie.text.pdf.PRStream.toPdf(PRStream.java(Compiled Code)) at com.lowagie.text.pdf.PdfIndirectObject.writeTo(PdfIndirectObject.java(Co mpiled Code)) at com.lowagie.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java(Compiled Code)) at com.lowagie.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java(Inlined Compiled Code)) at com.lowagie.text.pdf.PdfWriter.addToBody(PdfWriter.java(Inlined Compiled Code)) at com.lowagie.text.pdf.PdfReaderInstance.writeAllVisited(PdfReaderInstance .java(Compiled Code)) at com.lowagie.text.pdf.PdfReaderInstance.writeAllPages(PdfReaderInstance.j ava(Compiled Code)) at com.lowagie.text.pdf.PdfWriter.addSharedObjectsToBody(PdfWriter.java(Com piled Code)) at com.lowagie.text.pdf.PdfWriter.close(PdfWriter.java:1178) at com.lowagie.text.pdf.PdfDocument.close(PdfDocument.java:934) at com.lowagie.text.Document.close(Document.java(Compiled Code)) at xxxxx.pdf.FormattedOriginalWageScheduleArt8.writePdf(FormattedOriginalWa geScheduleArt8.java:188) etc... ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions