this is the code on how i convert my pdf into byte and allow it to download with a save as dialog box on localhost / online
protected void btnPDF_Click(object sender, EventArgs e)
{
//Byte array that will eventually hold our PDF, currently empty
Byte[] bytes;
//Instead of a FileStream we'll use a MemoryStream
using (var MS = new System.IO.MemoryStream())
{
//Standard PDF setup, iText doesn't care what type of stream we're using
var doc = new iTextSharp.text.Document();
var writer = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, MS);
doc.Open();
PdfPTable table = new PdfPTable(1);
table.TotalWidth = 585f;
table.LockedWidth = true;
var logo = iTextSharp.text.Image.GetInstance(Server.MapPath("~/image/logo.jpg"));
...
Go to the complete details ...