Click here to Skip to main content
15,912,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All

i want to ask about how to show a pdf file in asp.net page

i have upload a pdf file to my server, i have the link to the pdf file but how to see the pdf file so it's will show like image..

regards
galih
Posted
Updated 26-Dec-11 21:42pm
v2

 
Share this answer
 
You can show pdf file in image
C#
private void ReadPdfFile()
    {
        string path = @"c:\test.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);
        }

    }
 
Share this answer
 
Hi,

you can add iFrame in your page and URL of that iFrame will be your PDF file location. that way you can display PDF easily.

thanks
-amit.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900