hi all,

I need help or an idea in asp.net for

1.) Reading all the contents of a page against a url.

2.) Convert all these contents into a pdf file.

Thanks.

Hi there....,saw ur post and found that the same problem was faced by me too and the solution to such a problem is as follows...

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "cmd")
        {
            string filename=e.CommandArgument.ToString();
            string path=MapPath("~/PDF FOLDER IN WEBSITE/" + filename);
            byte []bts=System.IO.File.ReadAllBytes(path);

            Response.Clear();
            Response.ClearHeaders();

            Response.AddHeader("Content-Type", "Application/pdf");
            Response.AddHeader("Content-Length",bts.Length.ToString());
            Response.AddHeader("Content-Disposition","attachment; filename=" + filename);
            Response.BinaryWrite(bts);
            Response.Flush();
            Response.End();
        }
    }

hi KM, thanks for reply; this code works well and download the file from the specified location, but the downloaded file is not opened by adobe reader, it gives an error with the message...
"Adobe Reader could not open 'ASP.pdf' because it is either not a supported file or because the file has been damaged(for example, it was send as an email attachment and wasn't correctly decoded)."

i think you are looking for ..
HttpWebRequest and HttpWebResponse..!

yes dnanetwork,

you get me right. above code is working only for the files that are in my web directory....in fact I am searching for a solution that read all the contents against a url in the first step and then convert these contents in to a pdf file and download it into my local drive.

my problem has been solved using a third party tool html to pdf converter.

In this link

But I am looking for an open source solution.

yes your solution is more perfect. this is what I was looking for, thanks