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...
-
In a break, I had a look in to Asp.net Web Forms forum to see if there is anything that I can help. Indeed yes, there is a post surely I wil...
No comments:
Post a Comment