Hi, without viewing at your code, it is difficult to decide where the problem is. I'm doing the same thing with itextsharp and a mysql db in some project. Here is how i basically do it:
// Open ITextSharp Document and memstream
Document myDocument = new Document(PageSize.A4);
MemoryStream mstream = new MemoryStream();
PdfWriter.GetInstance(myDocument, mstream );
myDocument.Open();
// Do some itextsharp stuff to myDocument
// Close Document
myDocument.Close();
// Save stream to byte[] and save that byte[] to your db
byte[] fileData = mstream.GetBuffer();
// ...database-saving-logic....
As you're posting this in the asp.net forum, i suppose you want to write this pdf to your reponse stream? (or to file?!) This is how i write it to response-stream in page-load of a download page (you have to replace mimeType, fileName, fileSize and fileData by your own variables/strings - with fileData being the byte[] and filesize the length of that byte[]):
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = mimeType; // (guess it's "application/pdf")
Response.AppendHeader("content-disposition", "attachment; filename=" +
HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.AppendHeader("content-length", fileSize.ToString());
Response.BinaryWrite(fileData);
Response.End();
Hope this helps. If you've problems writing/reading this data from/to a file, let me know.