Close the doc first before reading it. ----- Original Message ----- From: "Ekta Ojha" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, July 05, 2005 8:20 PM Subject: [iText-questions] Reason for IO Exception
Hello All, Thanks to all of you for answering my doubts in my previous mails. Here is one more problem I am stuck with. After I create the pdf, I use the PdfStamper to make all the fields of the file as read only. However I am getting IO exception when trying to get the reader. Can anyone point me where I am going wrong. Here is what I do. Document doc=new Document(PageSize.LEGAL.rotate()...) ByteArrayOutputStream baosPDF = new ByteArrayOutputStream(); PdfWriter docWriter = null; docWriter = PdfWriter.getInstance(doc, baosPDF); doc.open(); PdfPTable table = new PdfPTable(21); ..... ..... doc.add(table); ByteArrayOutputStream completedPDF = new ByteArrayOutputStream(baosPDF.size()); byte[] buf = baosPDF.toByteArray(); // The step below is throwing me exception PdfReader reader = new PdfReader(buf); .... PdfStamper stamper=new PdfStamper(reader,completedPDF); stamper.close(); doc.close(); docWriter.close(); return completedPDF; __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------- 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_id=7477&alloc_id=16492&op=click _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------- 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_id=7477&alloc_id=16492&op=click _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
