I've commented out pdfStamper.Close() because when executed it seemed to close the memory stream, so I couldn't save it to a file anymore (!). The PdfReader.Close() is a little bit silly thing to do, yes (I realize it now). But why there isn't a PdfStamper.Flush() if there are problems like that?
I have tried without closing anything (just letting the `usings` call Dispose) and there were still problems (I will have to check if you want details on the problems). Perhaps it was that the fields weren't filled. I'll have to check (I'm a little dizzy from the 100 different things I've tried). If that's the case, and this is the right approach, then the real problem is in the field setting. But I wonder how can this be, since SetField() returns true... In the documetation of PdfStamper it says: "The reader will be closed when this PdfStamper is closed". Why the heck is the output memory stream being closed on PdfStamper.Close() ?!?! I use a quite recent (or perhaps the latest) version of iTextSharp. >From what I undertand now, this looks like a bug. I don't think my code closed the memory stream. > On Tue, 04 Jun 2013 17:31:45 +0200, _ <k...@dataverse.gr> wrote: > >> Any ideas on why the output file is small and corrupt? > > > Why is pdfStamper.Close() commented out, and why is the stamper closed > before the reader? > > Without pdfStamper.Close() several objects won't be written to the output. > Closing the reader before closing the stamper probably closes access to > some necessary > objects.------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. A cloud service to automate IT design, transition and operations > 2. Dashboards that offer high-level views of enterprise services > 3. A single system of record for all IT processes > http://p.sf.net/sfu/servicenow-d2d-j_______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > iText(R) is a registered trademark of 1T3XT BVBA. > Many questions posted to this list can (and will) be answered with a > reference to the iText book: http://www.itextpdf.com/book/ > Please check the keywords list before you ask for examples: > http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php