Pages

Monday, 20 February 2012

View The PDF file In Browser using C# code

private void ReadPdfFile()
    {
        
string path = @"C:\Swift3D.pdf";
        WebClient client = 
new WebClient();
        Byte[] buffer =  client.DownloadData(path);

        
if (buffer != null)
        {
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-length",buffer.Length.ToString());
            Response.BinaryWrite(buffer);
        }

    }

No comments:

Post a Comment