string fileName = "application.pdf"; iTextSharp.text.Document doc = new iTextSharp.text.Document(); /// /// crate your pdf document /// System.Runtime.Serialization.Formatters.Binary.BinaryFormatter binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); System.IO.MemoryStream stream = new System.IO.MemoryStream(); binaryFormatter.Serialize(stream, doc); byte[] bytes = stream.ToArray(); this.Response.Clear(); this.Response.AddHeader("content-disposition", string.Format("attachment;filename={0}", Path.GetFileName(fileName))); this.Response.ContentType = "application/pdf"; this.Response.BinaryWrite(bytes); this.Response.Flush(); this.Response.End();
Tuesday, September 14, 2010
How to convert PDF document (custom object) to a byte array
Subscribe to:
Post Comments (Atom)
Azure Storage Account Types
Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...
-
Demo: I was thinking a way to show images before actually uploading them to server. I would say to preview images using javascript. Obv...
-
Demo : I am using asp.net UpdatePanel control to partial page update. As there is no keyup event for the asp.net TextBox control, I add an ...
No comments:
Post a Comment