//convert pdf to bytes FileStream fs; fs = File.Open(fileName, FileMode.Open); byte[] bytBytes1 = new byte[fs.Length]; fs.Read(bytBytes1, 0, bytBytes1.Length); fs.Close(); //convert bytes to string string strModified = Encoding.Unicode.GetString(bytBytes1); //convert string to bytes byte[] b =Encoding.Unicode.GetBytes(strModified); //to open the attachment Response.AddHeader("Content-disposition", "attachment;filename=filename.pdf"); Response.ContentType = "application/pdf"; Response.BinaryWrite(b); Response.End();
Response.BinaryWrite(bytBytes1);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)